Wide open (NB4) spaces

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

Wide open (NB4) spaces

Postby GoAWest » Tue Feb 05, 2002 9:10 pm

I was trying to filter (Accept) a subject that looked something like this:

blah blah ... 6.13 VCD.r01 blah blah
(note: verified only one space between 13 & VCD)

So I set up an Accept filter of

6\.13\sVCD\.r

but it didn't work. So I then tried some variations

13\sVCD\.r
13 VCD\.r (just left a "<space>" in the middle spot)

and probably a few others. The one that finally worked is

13.*VCD\.r

This did allow a few other posts (e.g. I'm 13, Hi Mom VCD.rules!) but since I wasn't allowing automatic download I just didn't select the extra ones and only downloaded the ones I wanted.

So I'm not sure what was wrong but it seemed like NB wasn't locking on the \s as a single space. I did see a Dexter posting from 10-22-01 where he stated "The backslash does work when you are escaping a dot but it doesn't work with other characters including the asterisk and I just tested it with a square bracket. It should work consistently, we'll look into it."

Has this been fixed or am I doing something wrong? What's the correct RegEx syntax for matching a space (or non-space, \S, or etc.) in NB4b22?
GoAWest
 

RE: Wide open (NB4) spaces

Postby dexter » Tue Feb 05, 2002 9:18 pm

The \s, \S, \w, \W, \d, \D, etc are RegEx shortcuts that are supported in Perl but evidentally not in the RegEx engine we are using. (FYI, match white space or not, word or not, digit or not). To match just a space in your example, I'd create a set with a space in it using with brackets like this:

6\.13[ ]VCD\.r

That should do the trick.
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