in reply to Re^3: Regex fun
in thread Regex fun
It still didn't work as needed. That didn't remove the bases after the +N. However it did help me a lot and I managed to get a version which does indeed work as I want it (prints just to keep me in clear that what happens is indeed what should happen). I also added the || last to prevent that eternal loop you mentioned.
Though on the whole. I think that the (??{...}) would be best choice as repositioning the pos() is probably not a good idea in general. Note that I included the negative as well as positive match in this as that would remove the next regex I have :).
So thanks for helping me out on this :).while (m/[+-]([0-9]+)/g) { printf "pos ($1): %d -> ",pos($_)-1; pos($_) -= length($1)+1; printf "pos ($1): %d\n",pos($_)-1; s/\G[+-]$1[ACGTNacgtn]{$1}// || last; }
Though on the whole. I think that the (??{...}) would be best choice as repositioning the pos() is probably not a good idea in general. Note that I included the negative as well as positive match in this as that would remove the next regex I have :).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Regex fun
by JavaFan (Canon) on Dec 16, 2009 at 10:54 UTC | |
by Hena (Friar) on Dec 16, 2009 at 11:57 UTC | |
Re^5: Regex fun
by JadeNB (Chaplain) on Dec 16, 2009 at 15:57 UTC |
In Section
Seekers of Perl Wisdom