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:
$sTest = uc($sTest); if (uc($sLine) eq "REM $sTest" || Left(uc($sLine), 5 + length($sTest)) + eq "REM $sTest ") {
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:
if ($sLine =~ m/rem $sTest€/i) {
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,
John Davies
In reply to Space or end of string in regex by davies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |