Java regex expression to match at least one of Scandinavian alphabets -
i want evaluate text if contains @ least 1 scandinavian alphabet , ok no whitespace or more that. did wrong? tested string:
string nor = " d f ø ø å æ "; if(s.matches("[a-za-zæøåÆØÅ]+[\\s]*"))
matcher#matches
matches whole string
. therefore regular expression should match entire string
. can use .*
prefix match characters outside character classes:
if (s.matches(".*[a-za-zæøåÆØÅ]+[\\s]*") { // functionality related scandinavian expression }
Comments
Post a Comment