[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Backreferencing with ReplaceAll
From: |
Brian E. Seppanen |
Subject: |
Backreferencing with ReplaceAll |
Date: |
Mon, 21 Apr 2003 09:08:27 -0400 (EDT) |
Hi Folks:
I've been trying to tackle an issue with a file that I have to keep in
sync between several boxes, which is different wherever it goes.
Basically I need to take a line
phone=555-1212
and transform it into
phone=9,555-1212
One way I'd like to do this is to match the regular expression, and use
parenthesis to capture the results of the actual phone number match and
then refer back to the results of the match after I do the replacement.
I believe this would be a convergent means of performing this match.
Basically I'm trying to use the \1 to recover the phone number that was
matched, it would appear that \1 may not be available for use, and I was
wondering if there is an alternative.
{ /etc/phonelist
ReplaceAll "phone=([0-9-]{2,})" With "phone=9,\1"
}
Any ideas would be greatly appreciated.
Thanks
Brian Seppanen
seppy@chartermi.net
906-228-4226 ext 23
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Backreferencing with ReplaceAll,
Brian E. Seppanen <=