On Fri, Nov 10, 2000 at 11:31:07AM +0530, V Kamakhya wrote:
> 
> 
> 
> ---------------------- Forwarded by V Kamakhya/MLs/TCSCHENNAI on 10-11-2000
> 11:28 ---------------------------
> 
> Hi,
> In a c file, I defined:
> #define [^{]+[' ']+XYZ

try
#define ^[^{]+[' ']+XYZ

basically because you aren't matching from the start of the line
in the examples below with the problems it's inoring the first few { and
matches fine after them.

ie a regex can match anywhere in a lineunless you specify to start
matching from the start of the line.

> The idea is to prevent occurence of '{' before XYZ
> and used REG_EXTENDED in regcomp
> 
> I got the following output for valid and invalid patterns
> 
> a{  XYZ - Invalid
> a{{ XYZ - Invalid
> {a{  XYZ  - Invalid
> a{a  XYZ - Valid    -- how did this happen?
> a{a{ XYZ  - Invalid.
> {a  XYZ  - Valid      -  how did this happen?
> {aa XYZ   - Valid   - How did this happen?
> 
> 
> I am thoroughly confused. Help!
> 
> Kam
> 
> 
> 
> 
> 
> -- 
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://slug.org.au/lists/listinfo/slug

-- 
John

The difference between a good man and a bad one is the 
choice of cause - William James


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to