bitmonger
Joined: 03 Oct 2007 Posts: 3
|
Posted: Wed Oct 03, 2007 4:47 am Post subject: Putting 0 between two replacement group numbers |
|
|
I've run into a minor problem where I have two captured groups to use in a replacement, and I wanted to place a zero between them.
e.g the replacement should be a zero between \1 and \2 which ends up \10\2. I think you can see the problem - PFrank interprets this as group 10 followed by group 2 (although there are only 2 captured groups), and complains and stops. I tried substituting hex \x30 for the space - i.e. \1\x30\2, and also tried quoting the zero, but no luck. I worked around it by first replacing with a space followed by the zero thusly: \1 0\2 and then did a second replace of the space with nothing. I don't think this is unique to PFrank, just a fluky combination in a regex. Am I overlooking something obvious - Is there any way to define the zero in this position so it would be a single replace?
Cheers
BM |
|