| 语法 | 意义 | 说明 |
| "." | 任意字符 | |
| "^" | 字符串开始 | '^hello'匹配'helloworld'而不匹配'aaaahellobbb' |
| "$" | 字符串结尾 | 与上同理 |
| "*" | 0 个或多个字符(贪婪匹配) | <*>匹配<title>chinaunix</title> |
| "+" | 1 个或多个字符(贪婪匹配) | 与上同理 |
| "?" | 0 个或多个字符(贪婪匹配) | 与上同理 |
| *?,+?,?? | 以上三个取第一个匹配结果(非贪婪匹配) | <*>匹配<title> |
| {m,n} | 对于前一个字符重复m到n次,{m}亦可 | a{6}匹配6个a、a{2,4}匹配2到4个a |
| {m,n}? | 对于前一个字符重复m到n次,并取尽可能少 | ‘aaaaaa'中a{2,4}只会匹配2个 |
| "//" | 特殊字符转义或者特殊序列 | |
| [] | 表示一个字符集 | [0-9]、[a-z]、[A-Z]、[^0] |
| "|" | 或 | A|B,或运算 |
| (...) | 匹配括号中任意表达式 | |
| (?#...) | 注释,可忽略 | |
| (?=...) | Matches if ... matches next, but doesn't consume the string. | '(?=test)' 在hellotest中匹配hello |
| (?!...) | Matches if ... doesn't match next. | '(?!=test)' 若hello后面不为test,匹配hello |
| (?<=...) | Matches if preceded by ... (must be fixed length). | '(?<=hello)test' 在hellotest中匹配test |
| (?<!...) | Matches if not preceded by ... (must be fixed length). | '(?<!hello)test' 在hellotest中不匹配test |
| 特殊序列符号 | 意义 |
| /A | 只在字符串开始进行匹配 |
| /Z |