You are here: Re: help with regex « PHP Programming Language « IT news, forums, messages
Re: help with regex

Posted by IchBin on 08/04/06 20:27

John Dunlop wrote:
> Marcus:
>
>> I am trying to include the literal '\' (backslash) character in a regex.
>
>>From the beginning. What planet are you on? What country? Town?
> System? PHP version? Regex flavour?
>
>> I am not sure if I need to escape it, however...
>>
>> From http://www.regular-expressions.info/charclass.html:
>> "To include a backslash as a character without any special meaning
>> inside a character class, you have to escape it with another backslash.
>> [\\x] matches a backslash or an x."
>>
>> From http://www.tin.org/bin/man.cgi?section=7&topic=regex:
>> "...all other special characters, including `\', lose their special
>> significance within a bracket expression."
>
> The first is talking about regexes in general, the second about POSIX
> regexes.
>
> Take it from the horse's mouth: 'All non-alphanumeric characters other
> than \, -, ^ (at the start) and the terminating ] are non-special in
> character classes, but it does no harm if they are escaped.'.
>
> http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
>
>> These seem to contradict each other.
>
> If they're talking about the same flavour of regex, yes.
>

I am new to PHP but I just saw a free tool for building pcre patterns.
http://www.waterproof.fr/products/RegExpEditor


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

 

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

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