[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Syntax highlighting in / for Lua
- From: Philippe Lhoste <PhiLho@...>
- Date: Wed, 8 Aug 2001 11:03:09 +0200 (MEST)
Reuben Thomas wrote:
> > Why the spaces after the numbers and around the non-number letters are
> > matched?
> Not the spaces, but the "nothings". All the elements of your pattern are
Oops, thanks! I am a beginner both at Lua and RE, and I didn't knew I could
With pattern = "(-?%d+)", it works much better.
And to answer my second question, as the manual states: "gsub also returns,
as a second value, the total number of substitutions made.", and 'print'
takes and displays the two returned values. Using 'write' removes this unwanted
The challenge is still open: in the "(-?%d*.?%d*[eE]?-?%d*)" pattern, all
elements are optionals, so I match 'nothings', and illegal numbers like '.' or
I guess alternations (if that's what it is called) can be useful here. I
know there is a regex library somewhere, but I wanted to do it in 'pure',
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
Sent through GMX FreeMail - http://www.gmx.net