You are here: Re: How to escape string for preg_match? « PHP Programming Language « IT news, forums, messages
Re: How to escape string for preg_match?

Posted by Tim Van Wassenhove on 11/19/48 11:47

On 2006-05-10, squash@peoriadesignweb.com <squash@peoriadesignweb.com> wrote:
>
> tim wrote:
>
>> Either with \
>> preg_match( '/www\//', $str )
>>
>> or use a diffrent charcter as a delimiter
>> preg_match( '|www/|', $str )
>>
>
> Actually I want to use $str in the preg_match, i.e:
>
> preg_match( "$str" , 'www' )
>
> but since $str is 'www/', the forward slashes causes a problem

As already said: they are only a problem if you use them as delimiter...
Since webdevelopment is usually about URLs (with forward slashes) i
agree that is better to use a delimiter like | instead of /.


--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>

 

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

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