Aw: Re: regexp: matching expressions b4 and after ....

Ben Abbott bpabbott at mac.com
Tue Sep 9 07:36:13 CDT 2008


On Tuesday, September 09, 2008, at 06:17AM, <giovanni.lombardo at arcor.de> wrote:
> 
>
>Hi,
>
>thanks for the reply Ben. 
>As you see in your attempt, also the first "(-1)" gets replaced, which is exactly what the regexprep example command (in MATLAB) avoids.

hmmm ... Matlab gives me the result below ...

>> g='x^(-1)+y(-1)+z(-1)=0';
>> regexprep(g,'(?<=[a-z]*)\(\-[1-9]*\)','\_minus1')
ans =
x^_minus1+y_minus1+z_minus1=0

What does matlab give you?

Ben


More information about the Help-octave mailing list