egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Some help with regex

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
-T-
Voice


Joined: 08 Jul 2006
Posts: 4

PostPosted: Sat Jul 08, 2006 8:21 pm    Post subject: Some help with regex Reply with quote

This is my first go at tcl, so bear with me.

I'm having some problems with a regex function. If someone could take a look at it for me, I would be gratefull Smile

The code is kind of long, so I won't paste it here. Take a look at pastebin for it Smile

http://pastebin.ca/82855

Thanks again
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jul 09, 2006 5:20 am    Post subject: Reply with quote

What is the problem? nobody's going to look it up for you.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
-T-
Voice


Joined: 08 Jul 2006
Posts: 4

PostPosted: Sun Jul 09, 2006 11:30 am    Post subject: Reply with quote

there is a problem with the regex I think. It doesn't give me any errors, but it does not do anything even though I know the line of text matches the regex pattern
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Jul 09, 2006 8:44 pm    Post subject: Reply with quote

Code:
if {regexp {.*(Wb|wB|wb|WB|GREETINGS|...)(!!| )?(\(|\*).*\)?(!!| )?(Wb|wB|wb|WB|FECKER|... remember this?|\|\|\|).*} $txt == 1} { ... }

FYI
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM


Last edited by Alchera on Sun Jul 09, 2006 10:38 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
-T-
Voice


Joined: 08 Jul 2006
Posts: 4

PostPosted: Sun Jul 09, 2006 9:18 pm    Post subject: Reply with quote

hmm, I don't see a difference in that code and the one I have myself
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Jul 09, 2006 10:38 pm    Post subject: Reply with quote

-T- wrote:
hmm, I don't see a difference in that code and the one I have myself

There isn't. I pasted it for the information of others. I am not an expert regexp person but at first glance that looks like it would never function.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
-T-
Voice


Joined: 08 Jul 2006
Posts: 4

PostPosted: Mon Jul 10, 2006 10:02 am    Post subject: Reply with quote

the pattern work in my mirc script. Unless the tcl regex engine is very different from the on used in mirc, it should work
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Jul 10, 2006 10:19 am    Post subject: Reply with quote

Tcl (Tool Command Language) is a different animal to any mIRC "script".

I suggest you read Tcl Built-In Commands - regexp manual page.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Jul 16, 2006 4:20 pm    Post subject: Reply with quote

tcl's regex uses | to *concatenate* strings, not OR them..Maybe that's your problem? It also uses () to capture a segment for reporting... And there's also a -nocase option, so you don't need to search for various cases of "WB"
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Tue Jul 18, 2006 1:25 am    Post subject: Reply with quote

Code:
% regexp {moo|m00|m0o} moo
1
% regexp {moo|m00|m0o} mo0
0
% regexp {moo|m00|m0o} m0o
1
% regexp {moo|m00|m0o} m00
1


are you sure about your previous statement rosc2112?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Jul 18, 2006 2:47 pm    Post subject: Reply with quote

Just going by the docs and my own observations:

An ARE is one or more branches, separated by `|', matching anything that matches any of the branches.

A branch is zero or more constraints or quantified atoms, concatenated. It matches a match for the first, followed by a match for the second, etc; an empty branch matches the empty string.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber