Re: still not friends with RegExps..
| From: | Gyozo Papp | Date: | Tue, 15 May 2001 18:03:59 +0000 |
| Subject: | Re: still not friends with RegExps.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52899@lists.php.net to get a copy of this message | ||
Hello,
while I was reading the post from 'elias', a fairly old question came in my mind which
I've not get any answer yet.
Maybe you can do it.
There is a function quotemeta() which escapes all special regexp character such as:
. \ + * ? [ ^ ] ( $ )
with a '\' except one the '|' pipe.
what reason for this behaviour?
----- Original Message -----
From: "Taylor, Stewart" <Stewart.Taylor@uk.thalesgroup.com>
To: "'elias'" <elias_bachaalany@yahoo.com>;
<php-general@lists.php.net>
Sent: 2001. május 15. 15:16
Subject: RE: [PHP] still not friends with RegExps..
> preg_replace does not seem to agree with '\\'.
> Below seems to work with ereg_replace.
>
> <?php
> $pat = "[*+;\\-]";
> $rep = " ";
> echo ereg_replace($pat,$rep,$string);
> ?>
>
> -Stewart
> ~
>
> -----Original Message-----
> From: elias [mailto:elias_bachaalany@yahoo.com]
> Sent: 15 May 2001 23:37
> To: php-general@lists.php.net
> Subject: [PHP] still not friends with RegExps..
>
>
> Hello,
>
> Maybe RegExps are still my point of weakness...but I still like them as much
> as I like the Self-Reference phrases...
>
> Okay now, how can i replace all the matches of "\" , "*", "+",
> "-" and ";"
> with an empty string by calling once the preg_replace() or str_replace() or
> any string replace function? ("")
>
> Do i have to call it as many times as i got different replacments?
>
> -elias
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>