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.
Old posts that have not been replied to for several years.
-
cerberus_gr
- Halfop
- Posts: 97
- Joined: Fri Feb 07, 2003 8:57 am
- Location: 127.0.0.1
Post
by cerberus_gr »
Hello,
I have these questions:
1) I want to write a procedure which return the number of characters that exist in a text....
proc num:char { char text } { }
example: [num:char hello l] returns 2
2) How could I strip out the bold, color, reverse and underline codes, such as $strip in mirc scripting?
3) I have set a variable as:
set path$id hello
If I want to read this variable should write ${path$id} or this is not true?
Any ideas? Thx
-
ppslim
- Revered One
- Posts: 3914
- Joined: Sun Sep 23, 2001 8:00 pm
- Location: Liverpool, England
Post
by ppslim »
1: Use
Code: Select all
prco num:char {str chr} {
return [regexp -all "\[${chr}\]" $str]
}
2: See the likes of No!Spam.tcl. It has a good CTRL code stripping system, again usign regexps.
3: Yes, that is correct.
However, please watch how you use $ in variable names. This is a very easy way to get caught out.
-
cerberus_gr
- Halfop
- Posts: 97
- Joined: Fri Feb 07, 2003 8:57 am
- Location: 127.0.0.1
Post
by cerberus_gr »
Thx ppslim
I hate regexp by the way, because I don't undestand it

-
ppslim
- Revered One
- Posts: 3914
- Joined: Sun Sep 23, 2001 8:00 pm
- Location: Liverpool, England
Post
by ppslim »
I love it, because I don't understand it.
Don't fear somthing for that. Fight it by learning it. I am slowly doing so (yes, even I have my flaws).
Regexp is so damned powerful, but with scripting power, there comes the dificulty in mastering it.