help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: David Bateman
Subject: Re: Aw: Re: regexp: matching expressions b4 and after ....
Date: Tue, 09 Sep 2008 16:04:11 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080725)

Ben Abbott wrote:
On Tuesday, September 09, 2008, at 06:17AM, <address@hidden> 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?

Yes the pattern should be '(?<=[a-z]+)\(\-[1-9]*\)' to get the desired behavior.

D.

--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob) 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax) The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]