Noob requires help with regex and back references
Posted: Fri Mar 26, 2010 10:10 am
Hello everyone,
I'm completely new to regexp so bear with me if my problem turns out to be boringly simple.
I have a date - 1.1.2010
this date needs to be converted to a format whereby all single digit numbers are preceded by 0 giving me 01.01.2010.
My regexp expression looks like this (it's our own script language so you may not know the syntax)
REGEX_REPLACE('(\d{1})(\.)(\d{1})(\.)(\d+)','1.1.2010','0$1$20$3$4$5')
The problem area is highlighted red. If I try to add a zero directly after the reference number 2 regex interprets this as reference number 20 and returns a null string
How on earth do I complete my string?
Any help is appreciated.
Greets from Germany!
I'm completely new to regexp so bear with me if my problem turns out to be boringly simple.
I have a date - 1.1.2010
this date needs to be converted to a format whereby all single digit numbers are preceded by 0 giving me 01.01.2010.
My regexp expression looks like this (it's our own script language so you may not know the syntax)
REGEX_REPLACE('(\d{1})(\.)(\d{1})(\.)(\d+)','1.1.2010','0$1$20$3$4$5')
The problem area is highlighted red. If I try to add a zero directly after the reference number 2 regex interprets this as reference number 20 and returns a null string
Any help is appreciated.
Greets from Germany!