|
From: | David Bateman |
Subject: | [Changeset] Re: Aw: Re: regexp: matching expressions b4 and after .... |
Date: | Tue, 09 Sep 2008 13:16:46 +0200 |
User-agent: | Thunderbird 2.0.0.16 (X11/20080725) |
David Bateman wrote:
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.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.In practice I'm looking for the look-around operators for OCTAVE as described in MATLAB.Where exactly is "look-around" explained? D.
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 address@hiddenMotorola 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
[Prev in Thread] | Current Thread | [Next in Thread] |