On Wednesday 18 April 2001 22:55, you wrote: > >oops. The expression should read '/\[([^\]]+)\]/' > > Thanks all, i used this code and it works: > > preg_match("/\[(.+)\]/",$msg_array[$i],$segments); Note: This won't do what you expect, since the ".+" part will match as much as possible. Example: For "This [is a] string [with] multi [brack]ets" it will match "is a] string [with] multi [brack" A better solution would be "/\[(.+?)\]/" The '?' after the '+' tells it to match as little as possible. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) /* you are not expected to understand this */ - from the UNIX V6 kernel source -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
- Re: [PHP] regular expression Christian Reiniger
- [PHP] REGULAR EXPRESSION kaab kaoutar
- Re: [PHP] REGULAR EXPRESSION Richard Lynch
- [PHP] Regular Expression Jeroen Geusebroek
- Re: [PHP] Regular Expression Wico de Leeuw
- Re: [PHP] Regular Expression Christian Reiniger
- Re: [PHP] Regular Expression Christian Reiniger
- Re: [PHP] Regular Expression Jeroen Geusebroek
- RE: [PHP] Regular Expression Andrew Braund
- Re: [PHP] Regular Expression Martín Marqués
- [PHP] regular expression Christian Reiniger
- [PHP] regular expression Galkov Vladimir
- [PHP] Re: regular expression liljim
- [PHP] Re: regular expression liljim
- [PHP] Re: regular expression liljim
- Re: [PHP] regular expression Christian Reiniger
- Re: [PHP] regular expression DL Neil
- [PHP] Utility script: dates DL Neil
- [PHP] Regular Expression Adam . Whitehead
- Re: [PHP] Regular Expression Jason G.
- Re: [PHP] Regular Expression Andrey Hristov