Mismatch and regex newbie problem still problem
So to sum-up. If the regex i'm looking for is "testing" and the string to search the regex for is "tastung" (obviously this is a short example but i'm dealing with more complex regular expressions. how can i get the number of mismatches. Basically the output of the program would tell me:
2 mismatches found in string "tastung" at position 2 (a) and 5(u).
I have tried the iterator above but does not seem to do what i want??? std::string::const_iterator start = in.begin(); std::string::const_iterator end = in.end(); boost::sregex_token_iterator i(start, end, *regex, -1), j; while(i != j) { cout << *i << endl; }
# danova_fr@hotmail.com / 2006-08-29 13:08:04 +0000:
If the regex i'm looking for is "testing" and the string to search the regex for is "tastung" (obviously this is a short example but i'm dealing with more complex regular expressions.
how can i get the number of mismatches.
You can not. Not with regular expressions, you chose a completely wrong tool for the job. When the regex machine runs into a mismatch it abandons that branch. You would be very unhappy about performance of any regex machine that would provide the feature you're looking for. Hmm, a quick googling finds agrep and TRE, I have no idea if these would do what you need, you don't seem to provide enough context, and I have a feeling you are asking for a wrong solution to your problem. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991
Thanks to all for your comments.... It's a pity this class of functionality is not implemented in boost. I'm in the bioinformatics field and starting to work with boost. The use of regex in general as boost implements is quite common in the field and boost is very handy.!!! However at some point some advanced functionalities with insertion,deltions and repeats are very handy to use. Maybe there's a chance that some of the work out there get into boost as a boost_bio module ??? Note that biocpp.sourceforge.net has done some work on bioinformatics and that maybe it would be interesting to know if they were willing to move their codeinto boost. This will avoid people from having to install thousands of libraries to do their work. What do you think ??
participants (2)
-
david v
-
Roman Neuhauser