Dealing with Regexes for a specific replacement patternby gridlock (Novice)
|on Feb 21, 2004 at 04:55 UTC||Need Help??|
gridlock has asked for the
wisdom of the Perl Monks concerning the following question:
I've been dealing with this problem which has gotten me stumped - and I figure there has to be a way to do this simply with a regex rather than write a seperate function.... here's my jam...
I've had to deal with a stack of values who's occurrence is as follows:
Now - the trifle is as follows.....
This is a stack of values that are all delimited by the character "C". However, for all fields beginning with "338" - there is no field delimiter - the values starting with 338 have a standard format as follows:
What I want to do is replace this pattern with the same pattern with a C appended to it within the string... so I tried using the follwing regex:
s/338C\d\d\dC\d\d\dC\S\S\S\S\S\S\S\S /338C\d\d\dC\d\d\dC\S\S\S\S\S\S\S\S C/g
The only problem is.... although it inserts the "C" delimiters, the regex has wipes out the pertinent data of the digits and the "F"s - - is there a simple regex I can use to accomplish this? Any help will be much appreciated! Thanks is advance!
/Gridlock a.k.a. Debashis "Codito Ergo Sum"