[Changeset] Re: Aw: Re: regexp: matching expressions b4 and after ....

David Bateman David.Bateman at motorola.com
Tue Sep 9 06:16:46 CDT 2008


David Bateman wrote:
> 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.
>>
>> In practice I'm looking for the look-around operators for OCTAVE as 
>> described in MATLAB.
>>   
>
> Where exactly is "look-around" explained?
>
> D.
>
>
Ok, forget it.. I figured it out.. The issue is that matlab uses a 
different syntax for named tokens than PCRE, so we are obliged to look 
for named tokens like "(?<name>)" and replace them with the PCRE 
compatible "(?P<name>)". The test in Octave to do this was trapping 
"(?<=...)" and "(?<!...") as a syntax error for a matlab named token. 
The other lookaround operator "(?=...)" and "(?!...)" seem to work as 
pretty much as expected.

One issue is that PCRE does not accept arbitrary length lookaround 
expressions and so  "(?<=[a-z]*)" is not legal with PCRE. Though maximum 
length lookarounds are acceptable, so you can write instead 
"(?<=[a-z]{10})" for example.

I have a changeset to address this, but wonder if I should look for 
lookaround operators with "*" or "+" and replace with "{MAX_LENGTH}" and 
"{1:MAX_LENGTH}" respectively, with a warning about this limitation. 
Should I do this before submitting the changeset?

D.

-- 
David Bateman                                David.Bateman at motorola.com
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



More information about the Help-octave mailing list