How to search (S1 and S2) and (s3 or s4)

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

How to search (S1 and S2) and (s3 or s4)

Postby Traveler2530 » Tue May 18, 2010 3:33 pm

How to search for:

(string1 AND string2) AND (string3 OR string4)

Examples that find hits(in any order):

pebbles fred barney
wilma fred barney
pebbles fred wilma barney

Another search:

(string1 AND string2) OR (string3 AND string4)
(barney AND fred) OR (wilma AND pebbles)

Example hits would have(in any order):
fred barney
pebbles wilma
barney fred
pebbles wilma

Thanks in advance!
Traveler2530
Active Participant
Active Participant
 
Posts: 54
Joined: Wed Sep 17, 2008 3:35 pm

Registered Newsbin User since: 10/02/06

Postby dexter » Tue May 18, 2010 5:13 pm

Regular Expressions can't really be compared to binary searches in some cases. To get close to this:

(string1 AND string2) AND (string3 OR string4)

Would look something like this

string1.*string2.*(string3)?(string4)?

But order is important. So do to this:

pebbles fred barney

In any order would be a long RE. You'd have to list all the combinations manually.

Now if you set up a filter profile, you could enter each keyword on a different line in the Add Filters screen and then Newsbin will AND them all together so, they will work in any order.

To do this:

(string1 AND string2) OR (string3 AND string4)

Try

(string1.*string2)?(string3.*string4)?
User avatar
dexter
Site Admin
Site Admin
 
Posts: 9514
Joined: Fri May 18, 2001 3:50 pm
Location: Northern Virginia, US

Registered Newsbin User since: 10/24/97

Postby Traveler2530 » Tue May 18, 2010 8:50 pm

Thanks, I'll use the expressions and give the filter approach a try as well.

So for (fred AND barney) AND (wilma OR pebbles)

can I put fred barney in the filter and put (string3? string4?) in the search field?
Traveler2530
Active Participant
Active Participant
 
Posts: 54
Joined: Wed Sep 17, 2008 3:35 pm

Registered Newsbin User since: 10/02/06

Postby dexter » Tue May 18, 2010 11:16 pm

Yeah, that should work. Best thing to do is play with it and see what happens.
User avatar
dexter
Site Admin
Site Admin
 
Posts: 9514
Joined: Fri May 18, 2001 3:50 pm
Location: Northern Virginia, US

Registered Newsbin User since: 10/24/97

Postby Traveler2530 » Wed May 19, 2010 12:00 am

It appears the filters work only when searching subjects from "find" in the view messages window. I need to search thousands of groups.

From my tests, I must use a regex with the logic for four strings to search all of the groups at once.

Is there a source of simple regex expressions (like we discussed earlier fred/barney/wilma/pebbles example) free on the 'Net? I looked at several I found with google, but they were too complicated for a newbie.

thanks
Traveler2530
Active Participant
Active Participant
 
Posts: 54
Joined: Wed Sep 17, 2008 3:35 pm

Registered Newsbin User since: 10/02/06

Postby dexter » Wed May 19, 2010 8:43 am

Try http://www.regular-expressions.info/reference.html. We point to it from our own help pages.
User avatar
dexter
Site Admin
Site Admin
 
Posts: 9514
Joined: Fri May 18, 2001 3:50 pm
Location: Northern Virginia, US

Registered Newsbin User since: 10/24/97


Return to Regular Expressions

Who is online

Users browsing this forum: No registered users and 2 guests

cron