Add string after x characters
Posted: Mon Jan 12, 2009 4:17 am
Hi,
I'm quite new to regex, and the following expression drives me nuts.
What I have: Entz\u00FCndung des Zw\u00F6lffingerdarms
Endokarditis
What I need: EntzZZZZ00FC;ndung des ZwZZZZ00F6;
lffingerdarms Endokarditis
The first part to replace "\u" with "ZZZZ" is not the problem, but how to add the ";" at the end of
the string.
I tried
preg_replace(/ZZZZ++++/, /ZZZZ++++;/)
preg_replace(/(ZZZZ++++)/, /(ZZZZ++++;)/)
preg_replace(/ZZZZ{0,4}/, /ZZZZ{0,4};/)
none of these works.
It's always Searchstring + 4 character ADD string ;.
Please help.
Thanks a lot,
Chris
I'm quite new to regex, and the following expression drives me nuts.
What I have: Entz\u00FCndung des Zw\u00F6lffingerdarms
Endokarditis
What I need: EntzZZZZ00FC;ndung des ZwZZZZ00F6;
lffingerdarms Endokarditis
The first part to replace "\u" with "ZZZZ" is not the problem, but how to add the ";" at the end of
the string.
I tried
preg_replace(/ZZZZ++++/, /ZZZZ++++;/)
preg_replace(/(ZZZZ++++)/, /(ZZZZ++++;)/)
preg_replace(/ZZZZ{0,4}/, /ZZZZ{0,4};/)
none of these works.
It's always Searchstring + 4 character ADD string ;.
Please help.
Thanks a lot,
Chris