in reply to Re^2: 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
My sample code (the solution is actually the regex /^[a-zA-Z0-9]{6,20}$/) removes trailing line seperators (however they may currently be defined). A blank line will comprise two consecutive line seperators and will result in an invalid string being detected - which is consistent with OP's criteria (and original code).
Note that at least part of the rationale for posting a "complete sample" is to show others with a technique for providing stand alone code to demonstrate a problem or solution. The line handling code is incedental to the OP's question, but is an important part of a technique for providing test data.
Hmm, ok I'll go get that coffee now :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how should i test whether a string contains between 6 and 20 letters and numbers
by brian_d_foy (Abbot) on Jan 30, 2006 at 01:20 UTC | |
by GrandFather (Saint) on Jan 30, 2006 at 01:55 UTC | |
by brian_d_foy (Abbot) on Jan 30, 2006 at 03:24 UTC | |
by GrandFather (Saint) on Jan 30, 2006 at 19:40 UTC |