How to do RegEx strings check in two files fast?

How do I check if some strings in file A is somewhere in file B (not in the same line number of each file)?

e.g. a line in file A is "2, 3, 4" and somewhere in file B there is a line "2, 3, 4, 5"

I used Python and it is incredibly slow... for a 2G text file it takes days...
One file is with ~30K lines and another is ~1K lines...

What does this have to do with regexes?
And are you saying that your example is a match, even though the lines are different?
Maybe you should post your python code.
Last edited on
> I used Python and it is incredibly slow... for a 2G text file it takes days...
Python isn't that horribly inefficient.
For sure, just translating what you have into C++ won't magically transform 'days' into 'seconds'.

What you need is a better algorithm, not a different implementation.

Post a more meaningful example of your input files and your python code, and perhaps we can see what you're actually trying to do.

Topic archived. No new replies allowed.