$currentSentence =~ s/[\ba\b|\ban\b|\bthe\b]//g;
The main problem with the character class [\ba\b|\ban\b|\bthe\b] in the quoted substitution is that it's a character class. The \b resolves, I think, to a backspace control character (or maybe just a plain old 'b' character) and not a word boundary assertion as seems to be the intention. Likewise, | is just a plain old '|' character and not an alternation operator. So the character class finally becomes something like [\banthe|] depending on just what \b becomes.
Give a man a fish: <%-{-{-{-<
In reply to Re: Regular Expression, substitution
by AnomalousMonk
in thread Regular Expression, substitution
by lobs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |