You are here: Re: preg_match explanation « PHP Programming Language « IT news, forums, messages
Re: preg_match explanation

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].

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация