[pmwiki-users] pattern matching:

Patrick R. Michaud pmichaud at pobox.com
Mon Dec 4 11:22:11 CST 2006


On Sat, Dec 02, 2006 at 08:15:44PM -0500, The Editor wrote:
> I'm working on a "special" project and trying to get this pattern
> match to work and it almost works, but I seem to be having some
> problems with :, -, and . in the [ ].
> 
> preg_replace('|\{([\-\.A-Za-z0-9:_]+)\}|e', "Function($1)", $text);
> 
> I'm trying to get this to match expressions like the following:
> 
> {TEXT:Group.Name-36_End}
> 
> Any help would be appreciated.

Keep it simple:

    preg_replace('/\\{([-.:\\w]+)\\}/e', "Function('$1')", $text)

Pm




More information about the pmwiki-users mailing list