You are here: Re: Regular Expression - Can't match blank space - why not? - PHP Cheat Sheet.pdf (0/1) « PHP Language « IT news, forums, messages
Re: Regular Expression - Can't match blank space - why not? - PHP Cheat Sheet.pdf (0/1)

Posted by Gleep on 05/22/07 03:45

On Tue, 22 May 2007 01:28:10 GMT, "cluthz" <WHATEEVVEERR@by.co.uk> wrote:

>Help,
>
>I'm having this strange problem where my regular expression will not match
>blank space.
>
>Obviously I'm doing something wrong, but what?
>
>Lets say I have a string such as
>
>$test = "my example"
>
>then I want to search it for a string
>ereg ("\se",$test)
>
>I would expect the above to return true but it returns false.
>
>When I amend it to:
>ereg ("e",$test)
>
>I get a true response as expected.
>
>when I try
>ereg ("\s",$test)
>
>It returns false. (I would expect true as there is a space in the string).
>
>Please tell me what I'm doing wrong. It's driving me nuts
>
>Thanks in advance.
>


try ereg ("( e)",$test)
or ereg ("\s+e",$test)

you need to read-up on regex
there are plenty of tutorial online
they can be very tricky
http://www.dhtmlgoodies.com/scripts/regular-expression/regular-expression.html

i attached a cheat sheet

 

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

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