Quote:
Originally Posted by marav
Right
the good one with ?:
|
(A disclaimer: I don't use slackpkg+ and I don't know anything about it.)
I'm sure you know your regular expressions but for those who don't, a little recap:
a matches 'a'
a? matches '' and 'a'
a+ matches 'a', 'aa', 'aaa', 'aaaa',...
a* matches '', 'a', 'aa', 'aaa', 'aaaa',...
A dot matches any single character, so naturally:
. matches any character, e.g. 'b'
.? matches zero or one character, e.g. '', 'b'
.+ matches one or more characters, e.g. 'b', 'be', 'beg7z'
.* matches zero or more characters, e.g. '', 'b', 'be', 'beg7z'
(Literal dot, question mark etc need to be escaped by a backslash: \. \? \+ \* )
So, what does perl-.*-?alien match? It has 'perl-', then after that any characters, zero times or more, then a hyphen zero times or once, and then 'alien'. For example perl-anythingalien and perl-anything-alien. It seems -? is superfluous, as a hyphen is also an 'any character', and perl-.*alien would match even with a hyphen immediately before 'alien'. As a matter of fact, alien's package names don't even contain a substring '-alien'. Instead, they have a version number between the hyphen and 'alien'.
What if you wanted to check for the version number? [0-9] matches any single character between 0 and 9 (i.e. a digit), so [0-9]+ matches one or more digits. You could then use