in reply to Regex: match a word stem plus an optional suffix from a group
... but this works for me, if your "placeholder" is a variable starting with $ .
> perl -de0 ... DB<1> @a = qw(Russia Russia's Russias Russian) DB<2> $wordstem = "Russia" DB<3> x grep { /\bwordstem(s|\'s|n)?\b/i } @a empty array DB<4> x grep { /\b$wordstem(s|\'s|n)?\b/i } @a 0 'Russia' 1 'Russia\'s' 2 'Russias' 3 'Russian'
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex: match a word stem plus an optional suffix from a group
by element22 (Novice) on Jul 21, 2022 at 02:13 UTC | |
by Your Mother (Archbishop) on Jul 21, 2022 at 02:40 UTC |