/^([a-zA-Z]+)/
^ # match the start of the input string
( # start capture group 1
[a-zA-Z]+ # match one or more from the set {a..z,A..Z}
) # end capture group 1
Run Code Online (Sandbox Code Playgroud)
/\d|M|H/
\d # match a digit: {0..9}
| # OR
M # match the literal 'M'
| # OR
H # match the literal 'H'
Run Code Online (Sandbox Code Playgroud)
正如@Tim在评论中所建议的那样,最好写成: [\dMH]
RegExp.$1可能不是正则表达式(至少,它不能匹配任何东西).它可能是一种语言结构.
| 归档时间: |
|
| 查看次数: |
1353 次 |
| 最近记录: |