[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] hobbit-clients.cfg
Greg,
> Just curious -- in other regex implementations you have to "escape" the
> dot if you want it to match a literal period (dot) instead of any
> character. Does PCRE work the same way? I am always getting bit by
> this when I am trying to match IP addresses and domain names...
Ya you have to escape it if you wanna be sure it's a "DOT". You can try
it with pcretest on your shell
[root (at) hera ~/netdisco]# pcretest
PCRE version 4.5 01-December-2003
re> /\d\.\d.\d/
data> 1.234
0: 1.234
data> 123.4
No match
data> 1.2.3
0: 1.2.3
data> 12345
No match
So you can see that "\." will match exactly a DOT not any other
character as "." will do.
-Werner