Java - Error with an MD5 string check and REGEX -
i don't understand why doesn't work. , problem is.
public class md5hash { public static void main(string []args){ string md5hash = "69a329523ce1ec88bf63061863d9cb14"; system.out.println(md5hash); system.out.println(md5hash.matches("[a-f0-9] {32}")); }}
in order use md5hash.matches, needed compare char char. perhaps don't understand greedy quantifier {32} does?
and appreciated, thanks.
spaces in regular expressions significant. first part of regex matches single hex char, , second part asks match 32 spaces. need remove space. might want allow upper-case variant. so, should want:
system.out.println(md5hash.matches("[a-fa-f0-9]{32}"));
Comments
Post a Comment