[pmwiki-devel] php regex question

Dominique Faure dominique.faure at gmail.com
Wed Dec 5 12:02:22 CST 2007


On Dec 5, 2007 6:11 PM, Hans <design5 at softflow.co.uk> wrote:
>
> Is it possible to use  preg_replace("/$string/", $rep, $text)
> and preg_match_all, where $string is a text string which could contain
> preg control characters like ()[] and slashes etc, but these should
> not be interpreted as control characters, only as plain characters,
> but I cannot escape them easily, because I don't know if and where any
> may be?
>
> I am grateful for any hints.
>
> The alternative would be to use string functions only, and I would
> need to write a function which could pull all occurrences of $string in
> $text with their positions. Or perhaps there is such a function?
>
>  Hans
>

http://www.php.net/manual/en/function.preg-quote.php

should be your friend here... ;)

-- 
Dominique



More information about the pmwiki-devel mailing list