I have following code:
set variable1 "5"
set variable2 "6-7"
if {[regexp {md+M} $variable1 matchall]} {
puts "only a number has been provided and that is $matchall"
}
if {[regexp {md+M} $variable2 matchall]} {
puts "only a number has been provided and that is $matchall"
}
Basically, i want to only match variable1 which is just a number. variable2 does have a hyphen inside which should not match because i am using the m and M which are basically doing the same as b in normal regex which indicates word boundries. So when i run the code i get:
only a number has been provided and that is 5
only a number has been provided and that is 6
can anyone give me tip in the right direction? I am stuck with TCL 8.3 and cannot upgrade. But regex should basically work the same way as with never versions.