I have a piece of code that will try to extract URLs (through the use of regexs) from a piece of text. My code works fine when the text is small, however, when having a very large text, the
boost::regex_search function takes almost 1 minute to complete.
This is way too much executing time because on other texts, the
boost::regex_search takes 2 milliseconds at most, which is my scenario is acceptable. However, 1 minute is definitely too much.
As such, I need to find a way how to stop the function
boost::regex_search after a few milliseconds. Is this even possible? Are there other solutions to this? I don't want to change the regex expression because it has always worked correctly and efficiently. Also this problem is a one off.
Thanks for your time and any suggestions are greatly welcome.