S
Sara
I wonder if I can use $-vars in the LHS of a substitution? Camel says
"yes" I believe- I think they are called "backreferences" in the regex
section?
For example, I have
CAT1
DOG2
MOUSE
EEL
CAT1 is ALFIE
DOG2 is FRED
Say the result I want is
CAT1 is ALFIE
DOG2 is FRED
MOUSE
EEL
I tried something like:
s/^(\w+\d)(.+)\n\1 is ([^\n]+)\n/$1 is $3$2/gsm;
which runs with no errors, yet never matches anything. Can some
backref-experienced person point out my sins?
Cheers,
G
"yes" I believe- I think they are called "backreferences" in the regex
section?
For example, I have
CAT1
DOG2
MOUSE
EEL
CAT1 is ALFIE
DOG2 is FRED
Say the result I want is
CAT1 is ALFIE
DOG2 is FRED
MOUSE
EEL
I tried something like:
s/^(\w+\d)(.+)\n\1 is ([^\n]+)\n/$1 is $3$2/gsm;
which runs with no errors, yet never matches anything. Can some
backref-experienced person point out my sins?
Cheers,
G