Forum Discussion
hooleylist
Jun 23, 2011Cirrostratus
Now that you've figured out the regex option you could try using scan as well. scan is typically more efficient than a regex.
if {[scan $str {%[a-z0-9/+=]} match] and $match eq $str}{
log local0. "matched $str"
} else {
log local0. "no match for $str"
}
foreach str [list "1234" "asdf" "wqer!" "asfd/"] {
if {[scan $str {%[a-z0-9/+=]} match] and $match eq $str}{
log local0. "matched $str"
} else {
log local0. "no match for $str"
}
}
matched 1234
matched asdf
no match for wqer!
matched asfd/
Aaron