performing a proximity text search using regular expressions

General discussions about Advanced Find and Replace
Post Reply
emilys
Posts: 2
Joined: Sun Apr 06, 2008 1:29 am

performing a proximity text search using regular expressions

Post by emilys » Sun Apr 06, 2008 1:35 am

I've been trying to come up with a regular expression to perform a proximity ("NEAR") search on the find page and can't seem to figure it out. I'd of course be happy to be able to just use NEAR in the native type search query :D , but that doesn't seem to be an option so I thought I'd try the regular expression route. Can you help me create something that would find examples of a word that occur within 10 words of a second word, e.g., "united" that occurs within ten words of "nations"? I'm currently trying

\bunited\W+(\w+\W+){1,10}?nations\b

This seems to be accepted as a regular expression but it's not finding the example I've placed in the text box in the regular expression builder.

Thanks in advance for your ideas!

Emily

emilys
Posts: 2
Joined: Sun Apr 06, 2008 1:29 am

Re: performing a proximity text search using regular expressions

Post by emilys » Sun Apr 06, 2008 4:19 pm

Figured it out! :lol: I didn't need the word boundary syntax. The following expression worked for me:

united\W+(\w+\W+){1,10}?nations

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests