I was doing some Perl regex replacement tonight and noticed something odd. Perhaps I've missed something here...
I start with a file containing the following on one line:
Joe Goodman
I do a replace using Perl regex:
Find what: (\w*)\s(\w*)
Replace with: \2 \1
The result is Goodman Joe as expected.
Now I undo, and try this replacement using Perl regex:
Find what: (\w*)\s(\w*)
Replace with: "\2" "\1"
The result is "Joe" "Goodman""" """" "", not expected.
So I undo and try this replacement using Perl regex:
Find what: (\w*)\s(\w*)
Replace with: x\2x x\1x
The result is xGoodmanx xJoex, again as expected.
Now I undo and try this one:
Find what: (\w*)\s(\w*)
Replace with: (\2) (\1)
The result is (Goodman) (Joe)() ()() (), not expected. Perhaps the leading and trailing parenthesis for each replacement need to be escaped?
So I undo and try this one:
Find what: (\w*)\s(\w*)
Replace with: \(\2\) \(\1\)
The result is (Goodman) (Joe)() ()() (), not expected.
What am I doing wrong? I'm currently using UE 13.20+2. Any suggestions are welcome.
Thanks,
Tom
I start with a file containing the following on one line:
Joe Goodman
I do a replace using Perl regex:
Find what: (\w*)\s(\w*)
Replace with: \2 \1
The result is Goodman Joe as expected.
Now I undo, and try this replacement using Perl regex:
Find what: (\w*)\s(\w*)
Replace with: "\2" "\1"
The result is "Joe" "Goodman""" """" "", not expected.
So I undo and try this replacement using Perl regex:
Find what: (\w*)\s(\w*)
Replace with: x\2x x\1x
The result is xGoodmanx xJoex, again as expected.
Now I undo and try this one:
Find what: (\w*)\s(\w*)
Replace with: (\2) (\1)
The result is (Goodman) (Joe)() ()() (), not expected. Perhaps the leading and trailing parenthesis for each replacement need to be escaped?
So I undo and try this one:
Find what: (\w*)\s(\w*)
Replace with: \(\2\) \(\1\)
The result is (Goodman) (Joe)() ()() (), not expected.
What am I doing wrong? I'm currently using UE 13.20+2. Any suggestions are welcome.
Thanks,
Tom