Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: The craziest RegExes you ever created

by Hue-Bond (Priest)
on Jul 02, 2006 at 21:08 UTC ( [id://558888]=note: print w/replies, xml ) Need Help??


in reply to Re^2: The craziest RegExes you ever created
in thread The craziest RegExes you ever created

can you give an example of string it needed to match against? :)

Sure, but off topic I think. It was for using in an .slrn-score file (slrn is the news reader I use). I wanted to give -100 points to posts that where sent to some es.comp.os.linux.* group and to other group outside that hierarchy.

[es.comp.os.linux.*] Score:: -100 ~Newsgroups: ^es\.comp\.os\.linux {: Newsgroups: ^es\.comp\.os\.linux Newsgroups: ,([^e]|e([^s]|s([^\.]|\.([^c]|c([^o]|o([^m]|m([^p]|p([^\.] +|\.([^o]|o([^s]|s([^\.]|\.([^l]|l([^i]|i([^n]|n([^u]|u[^x]))))))))))) +)))) }

(Yes, it seems it isn't exactly the same regex; in my previous post I copied and pasted from another file). I won't explain the whole file format but roughly, the first line means we're working with messages in e.c.o.l.* groups. The "~Newsgroups" line means that messages whose Newgroups: field didn't match ^es\.comp\.os\.linux would be scored with -100 points (since if they don't match and are in ecol, they are crossposts). Alternatively, the following block says that messages with a Newsgroups: line that matched ^es\.comp\.os\.linux and matched some other thing (for example, Newsgroups: es.comp.os.linux.misc, alt.some.other), would also be scored.

--
David Serrano

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://558888]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-18 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found