Using java.util.regex.Pattern.compile() you can specify a pattern as parameter. But how can you specify flags like case-insensitive and ignore whitespaces as well?
Use the overload that accepts flags.
You can use the Pattern.compile(String regex, int flags) method that takes flags as well, or you can put them in your Pattern itself:
Eg.
Pattern.compile("(?i)a");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With