You see, I wanted to match everything. No exceptions. I wanted to slurp up the whole freakin' input. I wanted to match a certain beginning word, then match everything that followed it, and use s/// to replace just that word and one little character near the end. Instead of ending );, it was just going to end with ;.
$line =~ s/wordone\s*\((.*)\)\;//wordtwo\:$1\;/
So what had read "wordone(hello);" would now read "wordtwo:hello;" Very simple. And no matter how much was between those parentheses, I wanted it all, to just suck up the whole world.
But then my code went from suck to blow.
I thought that I had found the one good use for dot star, because I truly did want a greedy match of everything under the sun.
But dot star doesn't match newlines, it seems.
So instead of matching too much or too little, it instead matched nothing at all. Since there was no match, there was no substitution. And clearly, dot star is completely useless for anything except breaking your code.
Death to dot star! Long live ([^\)]*)!
We live in a society exquisitely dependent on science and technology, in which hardly anyone knows anything about science and technology.
- Carl Sagan
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Ode to Death to Dot Star
by broquaint (Abbot) on Nov 13, 2001 at 22:04 UTC | |
Re: Ode to Death to Dot Star
by dws (Chancellor) on Nov 13, 2001 at 22:34 UTC | |
Re: Ode to Death to Dot Star
by monkeygirl (Pilgrim) on Nov 13, 2001 at 22:06 UTC | |
Re: Ode to Death to Dot Star
by frankus (Priest) on Nov 13, 2001 at 22:04 UTC |