|Problems? Is your data what you think it is?|
Regex Confusionby Kelly22 (Novice)
|on Feb 10, 2010 at 14:26 UTC||Need Help??|
Kelly22 has asked for the
wisdom of the Perl Monks concerning the following question:
I have been working on a a perl script for awhile and everything is going well other then I am constantly confused by how the regexs work.
It is my understanding that a line like string =~ s/"//; should replace all occurrences of " with nothing. However the strings it acts on usually have 2 ", and to eliminate both of them I have resorted to repeating the line.
Another series of regexs are not working as I expect them to either.
I believe this should elimiate array entries that contain these strings, but it doent seem two work msot of the time. It doesnt eliminate the array entry that ends with
or the one that contains
And while I am at it I also want to elimiate all newline characters from a string and assumed that $string =~ s/\n//; would do that but it doesnt seem to work at all.
Clearly I am not getting something about regexs. I have read up on them and its still not clear to me what I'm doing wrong. Any help or generally some negative reinforcement would be greatly appreciated.