Reputation: 13
I want a regex to be used in Java which can contain any special characters, alphabets or numbers but not < OR > (angle brackets).
I found this, ^[\<>]*
but it gives
Invalid escape sequence
when used in my code.
Please help.
Upvotes: 1
Views: 1730
Reputation: 146
String regex="[^<>]*";
Pattern p= Pattern.compile(regex);
if(p.matcher("your input string").matches()){
// place for your logic
}
Upvotes: 2