[OpenSER-Users] Variable comparison symbols...

Iñaki Baz Castillo ibc at in.ilimit.es
Wed Nov 14 10:08:17 CET 2007


Hi, first I ask you not to reply a message if you are going to init a new 
thread, since your message appears in a thread it doesn't below to. Please, 
to create a NEW message press "create new mail", but never "Reply" (except if 
you are in fact replying to a message).


El Wednesday 14 November 2007 01:01:45 Brian Heath escribió:
>     I'm almost embarassed to ask...  But is there a place where one can
> read about the symbols:   ~  ^  \  $  ?  +    and what they do/mean?
>
>     For example, consider this following line:
>
>  if (!(uri =~
> "^sip:.+@(255\.255\.255\.255|(sip\.|sip5\.)?mydomain\.com):5080$"))
>
>     It looks like, to me, that it's checking to make sure that uri is NOT
> equal to any of combination of the data following the @ - but I'm not so
> sure exactly what I'm reading.  ie:  the ~ after the =, the ^ in front of
> sip, the .+ in front of @, the ? before mydomain and the trailing $.... 
> And why the period has the \ in front of them all...?

=~ means regular expresion comparison.

For example:

( "abc" == "123" ) -->  False
( "abc" =~ "^a" ) --> True


^ means starting with. This is:
"^abc" matches lines starting with "abc".

$ means line ending.

? means any character (0 or more times if I'm not wrong)



But sure sure you should look for any regular expressions manual. for example 
look in google for "unix regular expressions". There are lots of good 
manuals ;)





-- 
Iñaki Baz Castillo
ibc at in.ilimit.es




More information about the Users mailing list