Re: The length of search
Schamil Wackenhut <[email protected]> Sat, 22 Nov 2003 13:40:37 +0100
| Newsgroups | gmane.comp.jakarta.regexp.user |
|---|---|
| Message-ID | <[email protected]> |
* Arto Pastinen wrote:
> Why:
>
> RE re = new RE([:alnum:]{3,8});
> re.match("123456789");
>
> .. returns true?
Because there are 3-8 [:alnum:] characters in your string.
> .. and is there any way to get false current situation?
re.match("12");
> I need to make some security checks for form parameters, and
> i need to check that parameter contains 3-8 characters, and regexp
> seems quite handy for that.
Not more, not less? I think you need lookahead for this task.
--