Posted by peter on 10/17/06 06:56
> thanks that explains a lot.
> if i wanted to make it case insensitive should I simply remove the /i ?
> also I thought || was 'or', is this special only to preg_match?
> also
> why the /\. and not just \.
as colin pointed out the / are in this case signifying the start and end of
the pattern you could have quite easily for example used & which I have done
in the past when it seemed more appropriate. the \ is actually escaping the
.. as it has special meaning (a . matches any single character and of course
... matches 2 characters).
1 thing to watch with regular expressions is that certain characters have 1
meaning in 1 situation and another meaning ina different situation for
example ^ at the start of a regular expression means to match at the start
of a string (or new line depending on the mode you are running the regular
expression and of course which language the regular expression is used in)
but it also means anything but in a character set for example the following
would match anything BUT a w [^w].
[Back to original message]
|