in reply to Re^5: how should i test whether a string contains between 6 and 20 letters and numbers
in thread how should i test whether a string contains between 6 and 20 letters and numbers
The problem is that we have no idea where the data is coming from, but your solution constrains it to reading from the DATA filehandle. Your solution only works for those cases. If the string comes from a different source that doesn't process things by lines then your regular expression fails. It only works because you constrain the source of input. However, by making my simple change, you don't have to care about that. I've already shown you a string that broke your solution. Take any of the other infinite number of ways to get data inside a scalar and you'll have your example.
Why fight it? If you only want a-zA-Z0-9 in the string, why use a regular expression that would allow something else?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: how should i test whether a string contains between 6 and 20 letters and numbers
by GrandFather (Saint) on Jan 30, 2006 at 19:40 UTC |