in reply to Re^2: Replacing characters in a line
in thread Replacing characters in a line

Are we sure that D will always be preceeded by "TYR " ??
Manav

Replies are listed 'Best First'.
Re^4: Replacing characters in a line
by holli (Abbot) on Mar 04, 2005 at 13:32 UTC
    We can only tell from the example data.
    pelagic's regex is also unsafe. what if the line looks like
    ATOM 3316 N TYR B 24 97.479 18.805 2.990 1.00 36.32 + D N
    Then the alone "D" at the end will be replaced by "X". Intended??


    I would use the substr()-solution above. My regex was just meant as an optimization of perlsen's one, which is unneccesary complicated.

    Update:
    Striked the sillyness about the second "D".
    /me writes "Must read the question properly" 200 times.


    holli, /regexed monk/
Re^4: Replacing characters in a line
by pelagic (Priest) on Mar 04, 2005 at 13:23 UTC
    We are not!
    As the OP stated: there are two D's on every line.

    pelagic