[thelist] pcre regex in php

Burhan Khalid thelist at meidomus.com
Tue Sep 23 07:32:14 CDT 2003

throwaway at gmontague.co.uk wrote:

> Hi all,
>    I seem to be having a brain block with the following regex....
> I'm trying to extract all the text between [cn][/cn] 'tags' in a document.
> For example,
> $description = "[cn]Clio Gould, Edmund Coxon, Jeremy Morris, Stephen Morris,
> Katie Hull[/cn]"

Try this

preg_match_all("|\[cn\](.*?)\[/cn\]|i", $description, $x);
echo $x[1][0];


Burhan Khalid

More information about the thelist mailing list