say I have a list called mylist with the following elements:
dog.5.5.5
dog.6.6.6.xyz
cat.7.7.7
dog.7.7.7
and I want to only retrieve the elements that start with dog but end only with a number (i.e. - dog.5.5.5 & dog.7.7.7).
I've tried several variations on the regexp cmd, for example:
foeach elem $mylist {
regexp {^(dog)[^a-z]$) $elem, or
regexp {^(dog)[0-9]$} $elem, etc.
Basically I'm thinking I can do it all in one step with "regexp" cmd. I know I can do it if, for example, I first test for "dog" (via regexp) then test again for whether or not ending in a number, but I hoping to consolidate this "testing" in one "regexp" cmd. Is this possible? Can someone shed some light on using the various regexp syntax's available (i.e. '*' '?' '|' etc.)
...thanks!
dog.5.5.5
dog.6.6.6.xyz
cat.7.7.7
dog.7.7.7
and I want to only retrieve the elements that start with dog but end only with a number (i.e. - dog.5.5.5 & dog.7.7.7).
I've tried several variations on the regexp cmd, for example:
foeach elem $mylist {
regexp {^(dog)[^a-z]$) $elem, or
regexp {^(dog)[0-9]$} $elem, etc.
Basically I'm thinking I can do it all in one step with "regexp" cmd. I know I can do it if, for example, I first test for "dog" (via regexp) then test again for whether or not ending in a number, but I hoping to consolidate this "testing" in one "regexp" cmd. Is this possible? Can someone shed some light on using the various regexp syntax's available (i.e. '*' '?' '|' etc.)
...thanks!