kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #35713
Re: RegEx help
According to documentation at
http://docs.wxwidgets.org/3.0/overview_resyntax.html
*? +? ?? {m}? {m,}? {m,n}? *Non-greedy* quantifiers, which match the same
possibilities, but prefer the smallest number rather than the largest
number of matches (see Matching
<http://docs.wxwidgets.org/3.0/overview_resyntax.html#overview_resyntax_matching>).
There seems to be difference greedy vs non-greedy quantifiers!
Thanks,
Shiv
On Sat, May 5, 2018 at 6:49 PM, Jeff Young <jeff@xxxxxxxxx> wrote:
> We have a couple of regular expressions of the form:
>
> wxRegEx re( ".*?\\$\\{(.+?)\\}.*?", wxRE_ADVANCED );
>
>
> Now perhaps I’m too old to remember this stuff correctly, but .*? is
> redundant, isn’t it?
>
> And shouldn’t .+? just be .*? (And for that matter, shouldn’t it really
> be [^}]*?)
>
> Thanks,
> Jeff.
>
>
> Note that I’m looking at this because it needs to check for both ${…} and
> $(…) formatted envvars, which I think boils down to:
>
> .*(\\$\\{([^}]*)\\})|(\\$\\(([^)]*)\\)).*
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References