in reply to Regex help
I'm assuming those are the "legal" characters because those are the things that we "normally" expect in sentences and that weren't in the OP regex (and because you didn't say anything about dealing with stuff outside the ascii range of 0-127).my $decision = ( $input =~ /[^\s\w.,:;'"/?!~`-]/ ) ? "not okay" : "oka +y"; print $decision;
In this sort of exercise, saying exactly what's legal is often better than trying to list everything that's illegal, because you might find that your data contains "illegal" things that you forgot to include (or didn't know you had to, like unexpected control characters or things outside the ascii range).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex help
by Anonymous Monk on Jul 26, 2009 at 06:49 UTC |