[Pmwiki-users] Help with PHP regexp

Christian Ridderström chr
Thu Jan 8 18:06:54 CST 2004


On Mon, 5 Jan 2004, John Feezell wrote:

> I recently began studying PHP regular expressions so that I could use them 
> with PmWiki and FTS.  I have material from the PHP manual but would like to 
> know how others on the list have gained knowledge of these - websites, 
> books, etc..

Try this tool on them:

	http://www.weitz.de/regex-coach/

It can show a 'tree'-view of the regexp which is nice when you are 
drowning in parenthesis...

However, remember that in a statement like this:

	re = "la bla\n";

the last character in the string will not be 'n', since "\n" is 
translated... the regexps you see in pmwiki.php therefore have lots 
of double '\\' for every '\' ...

To see what the strings really contain, open local.php and add this line

	$EnableDiag=1;

then use the browser on a page with the action 'diag', i.e. like this:

	http://www.lyx.org/~chr/attachlist/pmwiki.php?action=diag

that page will (among lots of other stuff) contain the actual regexps as 
they are recieved by preg_match() and others. This is what you copy'n 
paste into 'regex-coach'

/Christian

-- 
Dr. Christian Ridderstr?m, +46-8-768 39 44       http://www.md.kth.se/~chr




More information about the pmwiki-users mailing list