stop words

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
nguma
Forum Newbie
Posts: 2
Joined: Sun Dec 02, 2007 2:49 pm

stop words

Post by nguma »

I have the following expression to find any instance of the word painting that is followed by another word:

/((painting) \w+)/

I am trying to run the same expression with a list of stop words, so that it would not match "painting" if the following word is "of" or "by"

Any idea on how to do such a thing?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

@(?:keep|words)\W+(?!stop|words)@is
potentially.
nguma
Forum Newbie
Posts: 2
Joined: Sun Dec 02, 2007 2:49 pm

Post by nguma »

thanks,

isn't it

@(?:keep|words)(?!stop|words)\W+@is

though?
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Post by GeertDD »

nguma wrote:thanks,

isn't it

@(?:keep|words)(?!stop|words)\W+@is

though?
No, you won't allow spaces between "keep" and "stop" then.
Post Reply