Sunday, 15 May 2011

java - Check for speciffic pattern -



java - Check for speciffic pattern -

i want check if string in pattern.

for illustration want check string matches pattern: 2012-02-20.

i.e: xxxx-xx-xx when x number.

is possible? said regular expressions.

use regex \d{4}-\d{2}-\d{2}

for checking use:

yourstring.matches(regexstring);

java regex

No comments:

Post a Comment