I get my expression mixed up. What I meant was: as DAVE mentioned:
Positional assertions are great, but why use them if you don’t have to, especially look-behinds, which can’t have variable string lengths? I need to get some sleep ;-) Thanks. Alfredo > On Apr 16, 2018, at 8:15 AM, F. Alfredo Rego <[email protected]> wrote: > > Jean-Christophe, Dave, Chris, > > Great suggestions. > > What Chris suggested worked on all cases, indented or not: > ^(?>(?:(?!//).)*#define.+) > > What Dave suggested worked on all cases, indented or not: > ^\h*#define > > What Jean-Christophe suggested (with that tricky space configured precisely) > worked on #defines without leading spaces but it also found an indented > COMMENTED #define: > > . . . > > > The simplest was Dave’s suggestion. > > What Chris and Jean-Christophe suggested motivated me to dive deeper into > positional assertions (with their various flavors and caveats), as Chris > mentioned: > > Positional assertions are great, but why use them if you don’t have to, > especially look-behinds, which can’t have variable string lengths? > > So much to learn! > > > With many thanks to the three of you, > > Alfredo > > > > On Apr 16, 2018, at 7:09 AM, Christopher Stone <[email protected] > <mailto:[email protected]>> wrote: > > On 04/16/2018, at 01:59, F. Alfredo Rego <[email protected] > <mailto:[email protected]>> wrote: >> I’m almost there, but not quite, because I’m interested in the UNCOMMENTED >> #defines, such as line 5 here: > > > Hey Alfredo, > > What you really want here is a negative lookahead assertion. > > ^(?>(?:(?!//).)*#define.+) > > It's much more flexible than a negative lookbehind assertion, although it can > be a bit hard to understand. > > -- > Best Regards, > Chris > > > > > On Apr 16, 2018, at 5:44 AM, Dave <[email protected] > <mailto:[email protected]>> wrote: > > How about > ^#define > or, if some might be indented, > ^\h*#define > > Positional assertions are great, but why use them if you don't have to, > especially look-behinds, which can't have variable string lengths? > > > > > > On Apr 16, 2018, at 3:48 AM, Jean-Christophe Helary > <[email protected] <mailto:[email protected]>> > wrote: > > > On my side I get the uncommented lines. > > (?<!// )#define > > <Screen Shot 2018-04-16 at 18.48.00.png> > > JC > -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit.
