For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > June 2007 > Re: regular expression help using regex.h in c program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: regular expression help using regex.h in c program
Geoff Clare

2007-06-21, 10:05 pm

bpatton wrote:

[color=darkred]
[color=darkred]
> Thanks, works perfectly


If you actually used "[:space:]*COMMENT[:space:]*" then the reason
it "worked" is because it is equivalent to just "COMMENT". The "*"
matches _zero_ or more repetitions. The "[:space:]" does not match
a whitespace character, it matches ':', 's', 'p', 'a', 'c' or 'e'.
To match a whitespace character you need "[[:space:]]".

The equivalent of your perl RE is:

" ^[[:space:]]*COMMENT[[:space:]]*=[[:spac
e:]]*\""

--
Geoff Clare <netnews@gclare.org.uk>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com