|Keep It Simple, Stupid|
Re^3: what is the best way to seperate the digits and strings from variable ?by polettix (Vicar)
|on May 09, 2005 at 13:04 UTC||Need Help??|
Please read the OP and the variable names in the test code before slapping hands. You can be right from your implied point of view, but I had my rationale when posting (which implies that I tested my code, of course)
Here, I'm considering digits as a character class, not as components of a number whose semantic is different from that of a string; this is why I name my variable $start_digits, not $num as you do. As you've surely noted, the OP never talks about numbers, always about digits (anyway, as I noted in my post, the OP was not clear about the usage of this extracted data).
Thus, when I thought about putting "*" or "+"*, I considered that if there were no digits it was good, and the returned string would be empty.
I think you can agree with me that, had the OP asked for initial letters, the regex:
would do the job.
*I swear I thought about that!
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')Don't fool yourself.