I am working with slightly outdated code, and I am trying to add a new regular expression to the validator counter, for our purposes, designated as "URL". As far as I understand, each part of the counter can be called in a separate regular expression. Anyway, here is what I have (and others follow, therefore, the final comma):
URL("[a-zA-Z0-9\r#;?-\'.:,!/\\s]{1,250}", "Up to 250 letters (upper and lower case), numbers, #, ;, ?, -, ', ., :, comma, !, /, blankspace and carriage return"),
I did a simple JUnit test to make sure that it works correctly. This is not true.
Caused by: java.util.regex.PatternSyntaxException: Illegal character range near index 15 [a-zA-Z0-9 #;?-'.:,!/\s]{1,250} ^
I am trying to limit the input of a type URL from 1 to 250 characters, which I thought I was doing, but Eclipse seems to be offended by this comma (I assume the comma is index 15). What am I doing wrong?