You are here: Re: regular expression space and 2 byte space « PHP Programming Language « IT news, forums, messages
Re: regular expression space and 2 byte space

Posted by Alvaro G. Vicario on 10/30/94 11:56

*** MD escribió/wrote (Fri, 25 Aug 2006 21:25:41 GMT):
> When receiving a particular string and if the string has a space/ 2 byte
> space with some trailing string.
> I want to remove the trailing string.
>
> $somestring = "some string";
> $match_pattern = "/(.*)\s.*/iu";
>
> preg_match_all($match_pattern, $somestring, $match );
> echo $match[1][0]
>
> Looks like this only works for single byte space.
>
> How can I define the regular expressoin so that it finds the 2 bytes space.

preg_replace('/ .*$/', '', some string"); // Not tested

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--

 

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

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