in reply to Regular expressions Containing Octal values?
It is best not to use \1 on the right hand side of a s///. See also "Warning on \1 vs $1" in perlre.
You can omit the escapes to make it a little cleaner: s/(\d+ *)L-homoserine/${1}2-Amino-4-hydroxybutyric acid/;
Also, the match doesn't work for cases with no leading number (you seem to suggest that this is possible). Therefore, something like this might be better: s/(\d*\s*)L-homoserine/${1}2-Amino-4-hydroxybutyric acid/;
--
John.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular expressions Containing Octal values?
by arunhorne (Pilgrim) on May 17, 2002 at 10:11 UTC | |
by arunhorne (Pilgrim) on May 17, 2002 at 10:58 UTC | |
|
•Re: Re: Regular expressions Containing Octal values?
by merlyn (Sage) on May 17, 2002 at 15:24 UTC | |
by jmcnamara (Monsignor) on May 17, 2002 at 16:03 UTC | |
by merlyn (Sage) on May 17, 2002 at 16:06 UTC |