|Welcome to the Monastery|
Re^5: what is the best way to seperate the digits and strings from variable ?by polettix (Vicar)
|on May 09, 2005 at 21:15 UTC||Need Help??|
I perfectly know that dbwiz gave a good advice, as you can note in Re^5: what is the best way to seperate the digits and strings from variable ?. I only argued upon his jumping to conclusions pointing out that he was working under assumptions that were different from mine, and he basically made my very same error: thinking in a restricted context.
And, jokes apart, I'm not fooling myself (even if you may think I'm trying to fool you); I'd like to see a single post of mine in which I was even slightly erroneous without taking my responsabilities. If you find, please point me out.
If you read my answer carefully, you'd see that:
Assigning $1 without testing is almost a capital sin in Regex parlanceThis is like saying that I shouldn't use symbolic references. Why not, if they're in a controlled environment? As dbwiz correctly noted, my regex ALWAYS matches, because it matches the empty string. So, why should I check if $1 is set if I already know that it's set? Just because otherwise I'm committing a capital sin?
Your initial code would pass a test against the only example provided by the OPI'm happy that you noticed, because I clearly stated that the question was not clear. On the other side, I completely disagree on the following consideration:
but it would fail in many other cases.Of which you provide no single example. And I can tell you why: you continue to assume that you have to extract numbers, and I continue to say that we could need digits. What if he wanted to swap the digit and alpha parts? Would you accept to move files:
all to ciccio-1.txt?
To definitively conclude this mess:
CheersCin-cin with our beer pints! (or whatever you like to drink)
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')Don't fool yourself.