1

Using C, I'm trying to find the location and number of matches of a substring within another parent string. Because I also need to include approximate (hamming distance) matches, I'm using the tre library found here: http://laurikari.net/tre/.

I'm having trouble understanding some of the documentation on the site, likely because I'm not too familiar with regex lingo. According to the tre documentation, I can get more specific information about 'submatches'. Are these the matches I'm looking for?

Thanks!

4

1 回答 1

1

要回答有关子匹配的部分问题:以示例字符串为例:

"noise aaa123bbb456ccc more noise"

和正则表达式:

aaa(.*?)bbb(.*?)ccc

然后整个比赛成立aaa123bbb456ccc,其中有两个子比赛:123456。这些子匹配也称为组(由括号之间的正则表达式部分匹配的字符串)。

于 2010-02-04T08:54:03.127 回答