i have this Regex in my Java program
if(Function.match(strAddress, "[~|+_=!$%^*@`(){}:;\"'<>?,]++"))
--do something
I want to include [ and ] in regex as well. I tried using escape characters as well but no go. How do I add these characters to my regex?
Use this example
public class test {
public static void main(String[] args) {
String text = "asda[]";
System.out.println("Test: "+ text.matches("[~|+_=!$%^*@`(){}:;\"'<>?,\\[\\]]++"));
}
}
I tried with \[ and [, its not working
Last run on above code gave output Test: false