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:
AA40772C192C56C338C001C001CF1F4F3F2338C001C001CF1F2F3F8184C52C000
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:
338C\d\d\dC\d\d\dC\S\S\S\S\S\S\S\S
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"
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.