Sorry....my example got mangled by the plain-text mangler.

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:

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
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...:-( ).

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".


In reply to Re^2: getting shell expansion to work by perl-diddler
in thread getting shell expansion to work by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.