Hi Jeff,
I think the regex you want is: ".*\$(\{.+\}|\(.+\)).*" (Note, I didn't
escape anything)The best way to develop regex would be by using tools like https://www.debuggex.com or https://regexr.com For example, the regex I gave you: https://www.debuggex.com/r/MTdQVK1dJHXhXtsF Basics: . any character * means any number (0 or more) of the previous character or group ? means zero or one occurrence of the previous character or group (in your case useless) ^ begin of string $ end of string "[^}]*" means any number of character except "}" The question is if you really want allow random strings before/after the environment var, because this means the exclusion of } would not work. Environment variables are normally limited to alphanumeric and underscore, I think. This means, instead of ".+" I would use "\w+" to match the name. Regards, Thomas Am 2018-05-05 um 15:19 schrieb Jeff Young: > 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 : [email protected] > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

