Omsai Jadhav
Omsai Jadhav

Reputation: 134

regexp in TCL is matching what is not expected

set modelList [lsearch -nocase -all -regexp -inline $args {(LAP|CAP)?[0-9]{2,5}}]

My this line of code is also matching mac address of format 7081.05e7.ba70, What am I missing. Please help.

Upvotes: 0

Views: 71

Answers (1)

Sabuj Hassan
Sabuj Hassan

Reputation: 39443

(LAP|CAP)? is optional in your regex as you placed a ? at there.

So your regex matches all of the followings:

LAP0123
CAP012
012
01234

Upvotes: 3

Related Questions