help-octave
[Top][All Lists]
Advanced

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

Re: Perl-like regexp support ?


From: Pascal A. Dupuis
Subject: Re: Perl-like regexp support ?
Date: Mon, 6 Dec 2004 10:20:03 -0600
User-agent: Mutt/1.5.6+20040722i

On Mon, Dec 06, 2004 at 04:12:54PM +0100, David Bateman wrote:
> Pascal, 
> 
> Are you aware of the "regexp" command in octave-forge. It doesn't
> quite have the interface you describe, but it is close...
> 

Didn't know , better turn 7 times the keyboard into my mouth before
speaking ...

OTOH, where can I find the doc about extended regexp ? I tried for
instance:

msg= 'INSERT INTO Tbl values (12, 16, 20);';
octave> [match, order, keyword, value]= regexp('(.*?)(values)(.*)', msg)
match =

   1  36
   1  16
  17  22
  23  36

order = INSERT INTO Tbl 
keyword = values
value =  (12, 16, 20);

so far so good, but then:

match= regexp('([:digit:]+)', data)
doesn't work, although this follows the regexp syntax given in grep manual

match= regexp('(\D*)(\d+)(.)', data)
doesn't work either, I suppose \d and \D are perl-specific (digit, not
digit)

and the correct way is :

[match, before, Id]= regexp('([^0-9]*)([0-9]+)', data)
match =

  1  4
  2  2
  3  4

before = (
Id = 12

Thanks for the reply

Pascal Dupuis

-- 
Dr. ir. Pascal Dupuis
K. U. Leuven, ESAT/ELECTA (formerly ELEN):  http://www.esat.kuleuven.ac.be/
Kasteelpark Arenberg, 10; B-3001 Leuven-Heverlee, Belgium
Tel. +32-16-32 10 21 -- Fax +32-16-32 19 85



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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