User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 17 Nov 2004, 12:13   #1
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Regular Expressions and asterixs

Ok, firstly. what regexp do i need to catch the string

*****SPAM*****
(5 asterixs, then SPAM, then another 5)
secondly, anyone got any good resources for getting better at reg exp ?
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 17 Nov 2004, 13:23   #2
Epcylon
Registered User
 
Join Date: Apr 2000
Location: Oslo, Norway
Posts: 78
Epcylon is a glorious beacon of lightEpcylon is a glorious beacon of lightEpcylon is a glorious beacon of lightEpcylon is a glorious beacon of lightEpcylon is a glorious beacon of light
Re: Regular Expressions and asterixs

Assuming you mean the actual string "*****SPAM*****", then a regex isn't what you want, because it's quicker and easier to just do string comparison (except if you're working in Perl, but who does that anymore? ).

On the other hand, if you're really after any string that starts and ends with 5 asterisks, I think this should do: \*{5}.*\*{5}
__________________
Epcylon
[R1]: noob | [R2]: B8S/ICD | [R3-5]: ICD | [R6]: HR | [R7-9.5]: HR/NoS |
[R10]: HR RecOff | [R10.5]: HR RO -> HR HC -> HR pe0n | [R11]: HR pe0n -> Leave of Absence |
[R12]: HR free-pe0n | [R13-]: HR pe0n
Epcylon is offline   Reply With Quote
Unread 17 Nov 2004, 13:25   #3
sayonara
Shai Halud
 
sayonara's Avatar
 
Join Date: Aug 2001
Location: Sunny Leeds \o/
Posts: 2,127
sayonara is just really nicesayonara is just really nicesayonara is just really nicesayonara is just really nicesayonara is just really nice
Re: Regular Expressions and asterixs

Really Newsie, I am shocked at you. Asterisk.

www.regularexpressions.info

/\*{5}SPAM\*{5}/

I am just learning these mothers properly myself but I think that ought to work ^.
__________________
meow
sayonara is offline   Reply With Quote
Unread 17 Nov 2004, 15:00   #4
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Re: Regular Expressions and asterixs



well, i have to use reg exp i think , cos its a .procmailrc thing that moves spam into the spam inbox.

besides, maybe i was talking about french cartoons.
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 17 Nov 2004, 15:23   #5
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Re: Regular Expressions and asterixs

actually i tell a lie
its a string that has

Subject
*****SPAM*****

and maybe some other things, on the same line.
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 17 Nov 2004, 17:21   #6
sayonara
Shai Halud
 
sayonara's Avatar
 
Join Date: Aug 2001
Location: Sunny Leeds \o/
Posts: 2,127
sayonara is just really nicesayonara is just really nicesayonara is just really nicesayonara is just really nicesayonara is just really nice
Re: Regular Expressions and asterixs

/(Subject\n\*{5}SPAM\*{5}(.*?)/

Assuming by "on the same line" you mean stuff following the last five asterisks.
__________________
meow
sayonara is offline   Reply With Quote
Unread 17 Nov 2004, 17:49   #7
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Re: Regular Expressions and asterixs

indeed

now to get bloody procmail to move them to the right place.
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Unread 17 Nov 2004, 19:54   #8
sayonara
Shai Halud
 
sayonara's Avatar
 
Join Date: Aug 2001
Location: Sunny Leeds \o/
Posts: 2,127
sayonara is just really nicesayonara is just really nicesayonara is just really nicesayonara is just really nicesayonara is just really nice
Re: Regular Expressions and asterixs

I forgot - if the "stuff" is multiline, change (.*?) to ((?m).*?)
__________________
meow
sayonara is offline   Reply With Quote
Unread 17 Nov 2004, 20:08   #9
NEWSBOT3
NEWSBOT
 
Join Date: Dec 2000
Location: The enby cave!
Posts: 4,872
NEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriendNEWSBOT3 needs a job and a girlfriend
Re: Regular Expressions and asterixs

it shouldnt be , its just a mail header line
__________________
[20:27:47] <nodrog-aawy> **** i think my housemate just caught me masturbating
[11:25:32] <idimmu> you are a little piggy arent you
[13:17:00] <KaneED> i'm so closet i'm like narnia
__________________
Pretty parks and funky scrap metal things here
NEWSBOT3 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 23:44.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018