[thelist] Regex back reference problem.

Joshua Olson joshua at waetech.com
Sun Dec 21 22:34:41 CST 2003


----- Original Message ----- 
From: <throwaway at gmontague.co.uk>
Sent: Sunday, December 21, 2003 4:23 PM


> $v = '2nd of the month';
> $replace_with = "\$1$v\$2";
>
> regex things......well he wants me to output the 12th back reference, then
the
> string 'nd of the month.' and then the 2nd back reference.

Hello Gav,

Not a PHP pro, but here's a thought...

Try escaping the first character of the string by converting it to a Hex
value.

Example:

'2nd of the month'

becomes

'\x32nd of the month'

(32 is the hex number for '2', and \xXX is the escape sequence for
characters in hex)

HTH,

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/SC/
706.210.0168



More information about the thelist mailing list