[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #33258] regexprep with empty replacement gives
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #33258] regexprep with empty replacement gives an error (not sure what cases) |
Date: |
Sat, 07 May 2011 14:02:58 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 |
URL:
<http://savannah.gnu.org/bugs/?33258>
Summary: regexprep with empty replacement gives an error (not
sure what cases)
Project: GNU Octave
Submitted by: None
Submitted on: Sat 07 May 2011 02:02:57 PM UTC
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Improvement/Optimization
Status: None
Assigned to: None
Originator Name: Jochen Weber
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 3.4.0
Operating System: Mac OS
_______________________________________________________
Details:
I stumbled across this error when using the syntax:
TEXTVAR = regexprep(TEXTVAR, '\s*$', '');
If TEXTVAR contains at least one space character at the end, no error occurs.
If, however, no spaces are at the end, I receive an error:
octave-3.4.0:1> TEXTVAR = 'test-input';
octave-3.4.0:2> TEXTVAR = regexprep(TEXTVAR, '\s*$', '');
error: regexprep: internal error calling pcre_exec; error code from pcre_exec
is -24
I understand that the pattern should be more correct:
octave-3.4.0:3> TEXTVAR = 'test-input';
octave-3.4.0:4> TEXTVAR = regexprep(TEXTVAR, '\s+$', '');
which works fine. So I'm not sure how much of a "coding" problem (on my part)
this is, but I would still say that this should not happen:
octave-3.4.0:5> TEXTVAR = 'test-input';
octave-3.4.0:6> TEXTVAR = regexprep(TEXTVAR, 'x*', '');
error: regexprep: internal error calling pcre_exec; error code from pcre_exec
is -24
Matlab handles these cases fine (no replacement, as the pattern is, in effect,
empty). I don't know how much control you have when calling the PCRE library
functions, but I think it would be nice to not have an error thrown if the
pattern resolves to an empty string (hence Item Group
Improvement/Optimization...).
Cheers,
/jochen
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33258>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #33258] regexprep with empty replacement gives an error (not sure what cases),
anonymous <=