正则表达式解析IRC风格/我表情?

时间:2013-11-19 19:54:23

标签: regex

我正在努力想出一个匹配的正则表达式:

/me slaps John around with a trout

和输出

Group 1: /me
Group 2: slaps John around with a trout

任何帮助将不胜感激:)

2 个答案:

答案 0 :(得分:1)

的内容
^(\/me) (.*)$

答案 1 :(得分:0)

你的正则表达式是这样的 (/ ME)\ S +(。*?)$

(/me)   << first group
\s+     << then one or more whitespace
(.*?)   << second group, one or more characters
$       << end of line