I want to check if one or more char is after # and save the channel in a var called $match.
I tried to match using this source:
Code: Select all
[regexp -nocase {#.+} $text match]
ProXy
Code: Select all
[regexp -nocase {#.+} $text match]
Code: Select all
regexp {((#)+([a-zA-Z0-9])+)} $text match
As such, it causes error when ## is on it's ownproc tm {in} {
regexp {((#)+([a-zA-Z0-9])+)} $in match
return $match
}
tm "hello to #all out there"
#all
tm "Funny old ##world"
##world
tm "##"
can't read "match": no such variable
tm "hello ## all"
can't read "match": no such variable
The regexpr works by looking for a #, followed by and uper/lower case letter or numbers, until the next non-matched char.proc tm {in} {
regexp {((#)+([\#a-zA-Z0-9]{0,})+)} $in match
return $match
}
tm "##"
##
tm "hello ## all"
##
Code: Select all
# returns channel name if found,
# else return nothing
proc getchannelname_ifexists {text} {
if {[regexp {(#[^, ]+)} $arg _ chan]} {
return $chan
}
}