java - Strange behavior of String's matches() method -


i encountered interesting issue string's matches(regexp) method.

asserttrue("33ccff".matches("[0-9a-za-z]{6}")); asserttrue("cc33ff".matches("[0-9a-za-z]{6}")); asserttrue("cc3355".matches("[0-9a-za-z]{6}")); asserttrue("cc9955".matches("[0-9a-za-z]{6}")); asserttrue("cc3366".matches("[0-9a-za-z]{6}")); asserttrue("cc3965".matches("[0-9a-za-z]{6}")); asserttrue("cc1961".matches("[0-9a-za-z]{6}")); asserttrue("cc9999".matches("[0-9a-za-z]{6}")); asserttrue("СС3966".matches("[0-9a-za-z]{6}")); // failing asserttrue("СС9965".matches("[0-9a-za-z]{6}")); // failing asserttrue("СС9966".matches("[0-9a-za-z]{6}")); // failing 

the last 3 assertion failing unexpectedly. couldn't find reasons why weird behavior happening. have same issue? have ideas?

by way, in case of being asked, java version following.

java version "1.6.0_26" java(tm) se runtime environment (build 1.6.0_26-b03) java hotspot(tm) 64-bit server vm (build 20.1-b02, mixed mode) 

the last 3 don't actually start ascii "c" character. start non-ascii character looks "c". doesn't match in [0-9a-za-z] set, hence pattern fails.

(i found out copying , pasting code text editor doesn't handle non-ascii characters terribly - came out "?".)


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -