
Metacharacters
- special characters with special meaning
- Escape special characters: not interpret special characters with their special meaning, force them to be treated as ordinary Characters
1
2
3String input = "foof";
String regex = "foo.";
input.matches(regex); // true
Here, the special meaning of dot is that it can be any character in its place.
Escape special Characters
- Escape special characters by using double backslashes
- why not single? backslash is an escape character in Java String literals as well. -> double backslashes
1 |
String input = "foof"; |




近期评论