I would like to filter out all words containing 1 number and 3 capital letters with a total length of 4. See my example here: http://gskinner.com/RegExr/?32taa
ArrayList<String> result = new ArrayList<String>();
for(int i = 0; i <= 10; i++){
String message = resp.data.get(i).message;
Matcher m = MY_PATTERN.matcher("\b(?=[^\d]*\d[^\d]*)[A-Z\d]{4}\b");
while (m.find()) {
String s = m.group(1);
result.add(s);
}
}
But when i pass my regexp pattern to the matcher method, i get the error:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
Do I need to swap \d
with another letter?