in reply to Re: Is there a way to make these two regex lines cleaner?
in thread Is there a way to make these two regex lines cleaner?
So, if you choose substitution: s/[^a-zA-Z0-9"' .?!-]//g
if transliteration (would be my choice): y/a-zA-Z0-9"' .?!-//cd
I'd still be inclined to escape the '-' in both cases: someone is all too likely to come along in a couple of years needing to add one more character to the allowed list, and the natural tendency would be to add it to the end.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Is there a way to make these two regex lines cleaner?
by AnomalousMonk (Archbishop) on Apr 17, 2022 at 22:55 UTC | |
|
Re^3: Is there a way to make these two regex lines cleaner?
by kcott (Archbishop) on Apr 18, 2022 at 04:40 UTC |