[Kicad-developers] RegEx help

2018-05-05 Thread 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, Je

Re: [Kicad-developers] RegEx help

2018-05-05 Thread Thomas Pointhuber
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: . a

Re: [Kicad-developers] RegEx help

2018-05-05 Thread Shivpratap Chauhan
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

Re: [Kicad-developers] RegEx help

2018-05-05 Thread Jeff Young
Ahhh… I’m mixing up XPath and RegEx syntax. ‘?’ is zero-or-one in XPath, not RegEx. Thanks Shiv & Thomas. Cheers, Jeff > On 5 May 2018, at 15:37, Shivpratap Chauhan wrote: > > According to documentation at > http://docs.wxwidgets.org/3.0/overview_resyntax.html >

Re: [Kicad-developers] RegEx help

2018-05-05 Thread Tiger12506
No, '?' also means zero-or-one in RegEx syntax, it's just that it *also* happens to mean "make the previous quantity modifier non-greedy" if there is a previous quantity modifier. Notice the double-question mark regex in the documentation quote previously pasted. That one means make the zero-or

Re: [Kicad-developers] RegEx help

2018-05-06 Thread Jeff Young
I ended up changing it as little as possible and testing it with https://regex101.com . I’m getting the distinct impression that if I went beyond that I’d risk shooting myself in the foot. ;) > On 6 May 2018, at 06:19, Tiger12506 wrote: > > No, '?' also means zero-or-on