【发布时间】:2014-05-17 01:30:12
【问题描述】:
我永远不会说我是 regex 方面的专家,而且由于我缺乏理解,我确信我对此有疑问。如果有人可以请尝试向我解释如何处理这种情况,我将非常感激。
string = "hello.world with_args, and_more_args #plus a comment
正则表达式
/^\w*\.(\w+)\s+(.*?)([^#]*)$/
群组
1. world
2. with_args, and_more_args #
3. plus a comment
我希望的输出是
1.world
2.with_args, and_more_args
3.#plus a comment
任何建议都将不胜感激,如果您能在此过程中教我一些东西,我当然不会抱怨。
【问题讨论】: