Re: Regular Expression
| From: | Tumurbaatar S. | Date: | Thu, 06 May 2004 04:30:42 +0000 |
| Subject: | Re: Regular Expression | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185495@lists.php.net to get a copy of this message | ||
Because the substrings can contain any char-s including
commas. Also I use reg exp not for splitting only but
for validating whether whole string and the substrings
are correctly formatted. Using reg exp requires much less
coding than traditional programming.
>
> Why not just strip out the braces and explode on commas? That'll be
> lighter than regexps any day. If the input is guaranteed to be
> formatted the way you describe, you could do something like:
>
> $out = explode(",", substr($in, 1, strlen($in)-2));
>
> --
> Paul Chvostek <paul@it.ca>
> it.canada
> http://www.it.ca/
> Free PHP web hosting!
> http://www.it.ca/web/