August 6th, 2013, 04:19 AM
Help with regex forum search
Hi. I'm new to regex and having a problem finding a way to search a forum for new threads. I have extracted the text from the forum, without the HTML.
These are 3 different threads in this example. I want to look for the word example and it has to be a new thread without any replies. In the first example there are 0 replies and 116 views. This would be a hit. But when I change the first thread to 1 reply, my regex code would jump all the way to the next thread with 0 posts in it and include all the text in between. This shouldn't be a hit.
This is my feeble code so far: example.*?ago by\s\w*\s0\s
How can I prevent it from causing a hit over multiple threads?
Is it possible to limit the area it searches after finding the word example to for instance 50 letters? Or is there another way?