in reply to taint mode
Hello McGaida, and welcome to the Monastery!
A side note: Did you really intend to match the | character?
Within a character class, | is just a character with no special meaning. Also, a hyphen doesn’t need to be backslashed if it’s the first or last character in the class (because Perl is smart enough to know that it doesn’t denote a range in these cases). So, assuming that you did mean to match the | character, your regular expression can be simplified from this:
/^([\w|\s|\/|\-]+)$/
to this:
/^([\w|\s\/-]+)$/
or, with different delimiters, to this:
m{^([\w|\s/-]+)$}
See perlrecharclass#Bracketed-Character-Classes.
Update: Re-ordered for improved clarity, thanks to MidLifeXis.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: taint mode
by McGaida (Initiate) on Mar 17, 2015 at 14:08 UTC |