A plurality of separators can be used | as hyphens, no escape
To match the special characters, you must first make the character "escape", that is, the backslash character \ in front of them.
Because in java \\ represents a \, use java.lang.String in replaceAll or split when using the \\ escape
character | Escape | Remark |
---|---|---|
$ | \\$ | |
( ) | \\( with\\) | |
* | \\* | |
+ | \\+ | |
. | \\. | |
[ | \\[ | |
? | \\? | |
\ | \\\\ | Because in java \\ represents a \, and also said that the regex \\ \, \\ resolved to regex so when the time is \\ |
^ | \\^ | |
{ | \\{ | |
| | \\| |