Using RegEx to show only RAR posts

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

Using RegEx to show only RAR posts

Postby dexter » Fri May 18, 2001 3:50 pm

Use the "Find In Subject" feature to isolate the .rXX files using Regular Expressions (RegEx). This RegEx will show all the .r?? files: \.r[a0-9][r0-9]. In english, this means look for a "." (the "\" escapes the ".", otherwise it means "match any single character") then match an "r", then match either an "a" or a digit 0 through 9, then match an "r" or a digit 0 through 9. If you are looking for a specific series like "amovie.rXX", use amovie\.r[a0-9][r0-9].

For a more thorough example, see http://www.newsbin.com/howto/rar.htm.

Have fun,

Dexter ;-)
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

RE: Using RegEx to show only RAR posts

Postby Kobato » Sat May 26, 2001 3:51 am

You Should include [r-z] because after .r99 come .s00 .t00etc... \.[r-z][a0-9][r0-9]
Kobato
 

RE: Using RegEx to show only RAR posts

Postby dexter » Sat May 26, 2001 12:34 pm

Yes, you're right, that would catch everything. I left that out of the original example to keep it simple and because very few rar posts I've encountered actually go into "s" and beyond.
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

RE: Using RegEx to show only RAR posts

Postby TimeOut » Tue Jun 05, 2001 12:09 pm

dexter what level of RE does newsbin support? classic? egrep? gnu? thanks.
TimeOut
 

RE: Using RegEx to show only RAR posts

Postby Quade » Tue Jun 05, 2001 4:31 pm

I'm not sure how to describe it. It seems very close to that used in Perl if that's any help.
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 44984
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97

RE: Using RegEx to show only RAR posts

Postby TimeOut » Tue Jun 19, 2001 4:55 pm

Are you sure? I mean, of course you're sure but I still find it hard to believe cause Perl RE is the super-super set of all REs. Would you mind, if it is ok, to reveal which RE lib you used in newsbin? Thanks for the answer and the great work!
TimeOut
 

RE: Using RegEx to show only RAR posts

Postby Quade » Tue Jun 19, 2001 11:36 pm

LAST EDITED ON 06-19-01 AT 10:37 PM (EST) ////////////////////////////////////////////////////////////////////////
// RegExp.h
//
// This code has been derived from work by Henry Spencer.
// The main changes are
// 1. All char variables and functions have been changed to char
// counterparts
// 2. Added GetFindLen() & GetReplaceString() to enable search
// and replace operations.
// 3. And of course, added the C++ Wrapper
//
// The original copyright notice follows:
//
// Copyright (c) 1986, 1993, 1995 by University of Toronto.
// Written by Henry Spencer. Not derived from licensed software.
//
// Permission is granted to anyone to use this software for any
// purpose on any computer system, and to redistribute it in any way,
// subject to the following restrictions:
//
// 1. The author is not responsible for the consequences of use of
// this software, no matter how awful, even if they arise
// from defects in it.
//
// 2. The origin of this software must not be misrepresented, either
// by explicit claim or by omission.
//
// 3. Altered versions must be plainly marked as such, and must not
// be misrepresented (by explicit claim or omission) as being
// the original software.
//
// 4. This notice must not be removed or altered.
/////////////////////////////////////////////////////////////////////////////

I've made a few mods to make it fit in a class. This is how the "Find" box is implemented. Filename and subject filters use something else which will be going away as soon as I can gut it out.
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 44984
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97

RE: Using RegEx to show only RAR posts

Postby TimeOut » Thu Jun 21, 2001 12:49 pm

Thanks a lot, that makes things very clear:)
TimeOut
 

RE: Using RegEx to show only RAR posts

Postby PNPman » Sun Jul 29, 2001 2:34 am

that all seems a bit complex
couldn't i just file filter like

noir - 0.[.]r..

to eliminate all noir - 0?.r??

the ? marks being replaced with any # value
User avatar
PNPman
Active Participant
Active Participant
 
Posts: 88
Joined: Fri May 18, 2001 9:29 pm

Registered Newsbin User since: 04/09/03

RE: Using RegEx to show only RAR posts

Postby Quade » Sun Jul 29, 2001 3:13 pm

Yes, that looks good too.

Perhaps "[.][r-t].." because any RAR posts with more then 100 parts uses the next letter.
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 44984
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97

RE: Using RegEx to show only RAR posts

Postby dexter » Sun Jul 29, 2001 4:17 pm

Yes but you run the risk on matching other things. The "." means "Any Character", not "Any Number". To match on any number, you have to use [0-9].
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

RE: Using RegEx to show only RAR posts

Postby PNPman » Wed Aug 01, 2001 2:40 am

ok just need to clarify on this (Whats inside the quotations is exactly what i'm entering, not the quotation marks themselves).

Subject Filters - Reject

"Dragon" will ensure that i don't don't download any files that have the word Dragon in the Subject

File Filters - Reject

"Dragon" will also ensure that i don't download any file that have the word Dragon in the filename?

or is it exact match so i would have to use a file filter of
".*Dragon.*[.]..."
User avatar
PNPman
Active Participant
Active Participant
 
Posts: 88
Joined: Fri May 18, 2001 9:29 pm

Registered Newsbin User since: 04/09/03

RE: Using RegEx to show only RAR posts

Postby Quade » Wed Aug 01, 2001 8:34 am

I'd think you can just use "Dragon" all by itself. I'll experiment with it to verify.
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 44984
Joined: Sat May 19, 2001 12:41 am
Location: 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