Regular expression to select non-matching pattern

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

Regular expression to select non-matching pattern

Postby Neuron111 » Sat May 27, 2006 8:24 am

Hi All,

This may be very basic.
I want to select lines containing non-matching pattern.

For example if we consider following cities:
London
NewYork
Delhi
Mountainview

If above are the given then how to select all cities except "Delhi"

Please suggest. Thanks.
Neuron111
n00b
n00b
 
Posts: 5
Joined: Sat May 27, 2006 8:20 am

Postby Quade » Sat May 27, 2006 11:59 am

If you're talking about the filter profiles, I'd reject
"Delhi". If you only want to see these cities I'd accept

London
NewYork
Mountainview

Basically "reject" is like "NOT" where the accept filters are like "OR".
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 45006
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97

Re:Regular expression to select non-matching pattern

Postby Neuron111 » Mon May 29, 2006 2:26 am

Thanks Quade for the reply. Sorry but I didn't get you, please can you explain!!! Actually I am looking for one line regular expression that will be "not" of any word, in this example "Delhi".
Neuron111
n00b
n00b
 
Posts: 5
Joined: Sat May 27, 2006 8:20 am

Postby itimpi » Mon May 29, 2006 2:48 am

As far as I know there is no regular expression to reject items containing specific strings.

If you Use Newsbin's filter profiles there are, however, both accept and reject options so via that method posts can be rejected.
The Newsbin Online documentation
The Usenettools for tutorials, useful information and links
User avatar
itimpi
Elite NewsBin User
Elite NewsBin User
 
Posts: 12607
Joined: Sat Mar 16, 2002 7:11 am
Location: UK

Registered Newsbin User since: 03/28/03

Postby Neuron111 » Mon May 29, 2006 2:51 am

Ohh ok. I am trying regular expressions in java and am stuck over here for this solution.
Neuron111
n00b
n00b
 
Posts: 5
Joined: Sat May 27, 2006 8:20 am

Postby Quade » Mon May 29, 2006 3:08 am

Yeah, this is regular expressions FOR NEWSBIN, not a generic regular expressions topic.
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 45006
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97

Postby Neuron111 » Mon May 29, 2006 3:11 am

Sorry can anyone suggest which one is the appropriate forum where this can be posted.
And yes if anyone knows the solution that will be great help!!!
Neuron111
n00b
n00b
 
Posts: 5
Joined: Sat May 27, 2006 8:20 am

Postby DThor » Mon May 29, 2006 9:48 am

A java or regular expression forum springs to mind. Have you tried google? There's hundreds of help sites out there.

DT
User avatar
DThor
Elite NewsBin User
Elite NewsBin User
 
Posts: 5943
Joined: Mon Jul 01, 2002 9:50 am

Registered Newsbin User since: 04/01/03

Postby Neuron111 » Mon May 29, 2006 1:01 pm

Ya man I tried google and was not able to come up with solution.
Will definitely update if I get the solution.
Neuron111
n00b
n00b
 
Posts: 5
Joined: Sat May 27, 2006 8:20 am

Postby Kiltme » Mon May 29, 2006 4:37 pm

While regex doesn't have a not match operator the containing program can.

You just invert the logical operation that had the regex find in it.

if ($Town =~ /Delhi/) # contains Delhi
if !($Town =~ /Delhi/) # doesn't contain Delhi

This comes up about newsbin and filtering the post list regularly.

If newsbin could process the ! logic, the post list would be easier to use :twisted:
User avatar
Kiltme
Seasoned User
Seasoned User
 
Posts: 638
Joined: Mon Jan 05, 2004 2:02 am

Registered Newsbin User since: 01/05/04

Postby obvious » Tue May 30, 2006 4:14 pm

Kiltme wrote:If newsbin could process the ! logic, the post list would be easier to use :twisted:

:twisted:
User avatar
obvious
Seasoned User
Seasoned User
 
Posts: 584
Joined: Wed Jun 06, 2001 8:30 pm

Registered Newsbin User since: 04/13/03


Return to Regular Expressions

Who is online

Users browsing this forum: No registered users and 2 guests