You are here: Re: !preg_match Regex not compiling « PHP Programming Language « IT news, forums, messages
Re: !preg_match Regex not compiling

Posted by Kimmo Laine on 06/18/19 11:34

"jamen" <jamen@invalid> kirjoitti
viestiss�:439e5e34$0$2098$edfadb0f@dtext02.news.tele.dk...
> Kimmo Laine wrote:
>> The missing ) is here: /(\)/
>> since you are using the backslash, which is an escape character, it
>> escapes the ), but actually you should be using
>> /(\\)/
>
> actually, this regex is still broken. You start a group, but never finish
> it. If you wanted to match ) then it should be
>
> /(\\))/

I assumed the searched term was "\" and not "\)". Because then the closing
brace would have been there already, since it wasn't escaped. And when you
think about it, if the search was indeed "\)", then they both need to be
escaped "\\\)" and then surrounded with the grouping braces (\\\))... then
finally /(\\\))/ . Way confusing... o_O

When regular expression is used to solve a problem, you'll only end up with
having two problems instead of one.

--
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>
Kimmo Laine <antaatulla.sikanautaa@gmail.com.NOSPAM.invalid>

 

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

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