[Serusers] search string, circumflex

Bruno Lopes F. Cabral bruno at openline.com.br
Wed Apr 20 14:04:47 CEST 2005


Hi there

it is not C syntax but regexp syntax, ^ means (at the beginning
of the string) and parenteses with | inside means, "one of
the following", so the first example will found

Contact: whatever at 192.168.
Contact: whatever at 10.
Contact: whatever at 172.16.
m: whatever at 192.168.
m: whatever at 10.
m: whatever at 172.16.

but WILL NOT found

anythingContact: ...
anythingm: ...

the second example will found both

From...
anythingFrom...

you problably get the picture now

hope this helps
!3runo


Che Sosa wrote:
> Hello list,
> I am not so familiar with C syntax but I suspect that the circumflex
> changes the parsing method. What is the difference between these two:
> 
> first-> search("^(Contact|m): .*@(192\.168\.|10\.|172\.16)")
> second-> search("(From|f):.*@foo.bar")
> 
> Questions:
> 1. How does the circumflex affect the string inside ( )
> 2. How is ( ) used?
> 
> Thanks,
> Che




More information about the sr-users mailing list