in reply to Re: getting shell expansion to work
in thread getting shell expansion to work
The RE pattern you use, "mc-lang-[^-]*-[^-]*.rpm" says (converting to perl syntax): /mc-lang-[^-].*-[^-].*.rpm/
The "*", unlike in perl, isn't an "affix count", but matches any string, including the null string.
I re-edited the base note to use the code tag to display the bash pattern -- it included square brackets inside of the parens.
I was trying to use the regular expression syntax from bash to match "one or more" of an item. From the bash man page:
As near as I can tell, perl doesn't have a similar syntax for RE's. It might be better for me to repost the base note with better wording/phrasing and a better example, since the example I used doesn't demonstrate my problem (and doesn't actually solve my my problem either, I just found out...:-( ).If the extglob shell option is enabled using the shopt builtin, + several extended pattern matching operators are recognized. In the f +ollowing description, a pattern-list is a list of one or more patterns s +eparated by a |. Composite patterns may be formed using one or more of +the fol- lowing sub-patterns: ?(pattern-list) Matches zero or one occurrence of the given patte +rns *(pattern-list) Matches zero or more occurrences of the given pat +terns +(pattern-list) Matches one or more occurrences of the given patt +erns @(pattern-list) Matches one of the given patterns !(pattern-list) Matches anything except one of the given patterns
What I want to do *may* not be doable, directly, using a bash expression -- since I'm not sure if the pattern matching in bash can control "greediness".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: getting shell expansion to work
by almut (Canon) on Dec 27, 2007 at 23:53 UTC | |
by perl-diddler (Chaplain) on Dec 28, 2007 at 20:58 UTC |