This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
-T-
Voice
Posts: 4 Joined: Sat Jul 08, 2006 8:18 pm
Post
by -T- » Sat Jul 08, 2006 8:21 pm
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
The code is kind of long, so I won't paste it here. Take a look at pastebin for it
http://pastebin.ca/82855
Thanks again
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun Jul 09, 2006 5:20 am
What is the problem? nobody's going to look it up for you.
-T-
Voice
Posts: 4 Joined: Sat Jul 08, 2006 8:18 pm
Post
by -T- » Sun Jul 09, 2006 11:30 am
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
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Sun Jul 09, 2006 8:44 pm
Code: Select all
if {regexp {.*(Wb|wB|wb|WB|GREETINGS|...)(!!| )?(\(|\*).*\)?(!!| )?(Wb|wB|wb|WB|FECKER|... remember this?|\|\|\|).*} $txt == 1} { ... }
FYI
Last edited by
Alchera on Sun Jul 09, 2006 10:38 pm, edited 1 time in total.
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
-T-
Voice
Posts: 4 Joined: Sat Jul 08, 2006 8:18 pm
Post
by -T- » Sun Jul 09, 2006 9:18 pm
hmm, I don't see a difference in that code and the one I have myself
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Sun Jul 09, 2006 10:38 pm
-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
-T-
Voice
Posts: 4 Joined: Sat Jul 08, 2006 8:18 pm
Post
by -T- » Mon Jul 10, 2006 10:02 am
the pattern work in my mirc script. Unless the tcl regex engine is very different from the on used in mirc, it should work
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Sun Jul 16, 2006 4:20 pm
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"
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Tue Jul 18, 2006 1:25 am
Code: Select all
% 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?
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Tue Jul 18, 2006 2:47 pm
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.