Regex 如何使用正则表达式提取子字符串?
因此,我试图找出Flex中的正则表达式,但我一辈子都想不出下面的方法。 从下面的示例中,我只需要提取出“Mike_Mercury”。 因此,我必须用RegExp或其他最好的工具,以某种方式去掉它周围的所有内容。此外,我需要它与其他样品以及工作。我是从RedditAPI中得到这个的,所以我必须从一大堆代码中提取相同的部分。谢谢Regex 如何使用正则表达式提取子字符串?,regex,actionscript-3,apache-flex,flash-builder,Regex,Actionscript 3,Apache Flex,Flash Builder,因此,我试图找出Flex中的正则表达式,但我一辈子都想不出下面的方法。 从下面的示例中,我只需要提取出“Mike_Mercury”。 因此,我必须用RegExp或其他最好的工具,以某种方式去掉它周围的所有内容。此外,我需要它与其他样品以及工作。我是从RedditAPI中得到这个的,所以我必须从一大堆代码中提取相同的部分。谢谢 <table> <tr> <td> &
<table>
<tr>
<td>
<a href="http://www.reddit.com/r/atheism/comments/q2sfe/barack_obamas_insightful_words_on_abortion/">
<img src="http://d.thumbs.redditmedia.com/9StfiHi7hEbf8v73.jpg" alt="Barack Obama's insightful words on abortion"
title="Barack Obama's insightful words on abortion" /></a>
</td>
<td>
submitted by <a href="http://www.reddit.com/user/Mike_Mercury">Mike_Mercury </a>
to <a href="http://www.reddit.com/r/atheism/">atheism</a>
<br />
<a href="http://imgur.com/lKFYr">[link]</a> <a href="http://www.reddit.com/r/atheism/comments/q2sfe/barack_obamas_insightful_words_on_abortion/">
[1722 comments]</a>
</td>
</tr>
</table>
提交人
到
试试这个正则表达式:
submitted by <a href=".*?">(.*?)</a>
提交人
使用HTML解析器。正则表达式不会解析任意HTML。