|Perl Monk, Perl Meditation|
Space or end of string in regexby davies (Vicar)
|on Feb 02, 2012 at 21:54 UTC||Need Help??|
davies has asked for the
wisdom of the Perl Monks concerning the following question:
Again, I have some code that works but I'm sure it could be better written using a regex that I don't know how to write. My code is:
Left is a sub I have written to help me until I get out of the habit of writing VBA instead of Perl. It's a very basic call to substr.
I have been trying to write something along the lines of:
The problem I have is replacing the € with something that means "a space or the end of the string". I'm not sure whether Corion is hinting at how to do this in Re: Regex - Matching prefixes of a word or whether it means "one or the other, but not both in a single construct". Either way, that is the closest my searching has come to an answer. Is there a better one, please?
TIA & Regards,