java foundation of escape

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 \\
^ \\^  
{ \\{  
| \\|  
Published 49 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/csdnzhang365/article/details/103569023