2

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!

JXG
  • 7,263
  • 7
  • 32
  • 63
David M
  • 710
  • 1
  • 8
  • 14
  • added a tre-library tag. it doesn't seem to have many questions on SO... but just in case anyone is looking. – JXG Feb 04 '10 at 08:34
  • Perhaps you could explain a bit more about what you're trying to match. Some examples of the input string(s) and desired output would help a lot. – Bart Kiers Feb 04 '10 at 08:40

1 Answers1

1

To answer a part of your question about sub-matches: take the example string:

"noise aaa123bbb456ccc more noise"

and the regex:

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

then the entire match holds aaa123bbb456ccc which has two sub-matches in it: 123 and 456. These sub-matches are also called groups (the strings that are matched by the part of the regex between parenthesis).

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288