troubleshooting Question

Find keywords in text blocks using Regex

Avatar of phoffric
phoffric asked on
Regular ExpressionsC++Algorithms
37 Comments6 Solutions1013 ViewsLast Modified:
Given a set of keywords, I would like to list each one that I find in a text block (including, say, the offset). Then I will fill the block with new text and search again until there is no more text to search.

I would like to use Boost regex since my understanding is that it is probably more efficient than a simple approach that I could come up with by using only C++ and STL. (BTW, I cannot use C++11.) Boost should also allow the program to be built on both Windows and Linux without platform dependent code. I have hardly used regex, so, if there is a tidy C++ solution, then I hope you will throw in a few words to help me understand the regex part so that I can add appropriate comments.

If possible, could you show the C++ function code? I can only use Boost and standard STL libraries, and standard C++ code.

Kent Olsen
Data Warehouse / Database Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 6 Answers and 37 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 6 Answers and 37 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros