How to make Perl half/full width-insensitive regular expressions?
6
votes
2
answers
523
views
In Perl,
/a/i
matches both A and a, so I don't have to write /A|a/
.
What is the easy way to write /4|4/
?
Yes, I'm talking about
lang-sh
$ unicode 4 4|grep U+
U+FF14 FULLWIDTH DIGIT FOUR
U+0034 DIGIT FOUR
Must I repeat each line,
if (/大茅埔段32(7|8|9).地/ ||
/大茅埔段32(7|8|9).地/) {...}
or is there a better way?
It's not that many characters, https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block)
By the way, how to make
$ echo A|perl -pwle 's/a/x/i'
match? (Both A's are wide.)
Asked by Dan Jacobson
(560 rep)
Feb 26, 2025, 02:16 AM
Last activity: Mar 1, 2025, 01:46 PM
Last activity: Mar 1, 2025, 01:46 PM