Thanks, Patrick.

Alfredo

> On Jun 22, 2019, at 1:15 PM, Patrick Woolsey <pwool...@barebones.com> wrote:
> 
> On Jun 22, 2019, at 13:03, F. Alfredo Rego <f.alfredor...@gmail.com> wrote:
>> 
>> I’m interested in finding “if” statements that contain the negation operator 
>> “!” (or potentially several negation operators) anywhere, regardless of 
>> blank lines, parentheses, indentation, and so on.
>> 
>> My motivation is to verify, one by one, the scope(s) of the negation(s).
>> 
>> For instance, considere this code snippet:
>> 
>>                 if ( ID ==   OK_ID )    OK_ID_procedure (ID);
>>            else if ( ID == fake_ID )  fake_ID_procedure (ID);
>>            else if ( ID ==  old_ID )   old_ID_procedure (ID);
>>            else if ( ID != lost_ID ) check_ID_procedure (ID);
>> 
>> 
>> I would like to select JUST THE LAST “if” statement, which is the only one 
>> that contains the negation operator, like so:
>> 
> 
> Based on your description above, I expect something like this should do the 
> job, or at least serve as a starting point for further experimentation :-):
> 
> Search for:    (( |)if \(.+?!=.+?$)
> 
> 
>> The best I have done, so far, is this regex, with a space as its first 
>> character to ignore #ifdef and such: 
>> if(?s).+?\(.*?!.*?(;|\{)
> 
> Since (?s) enables . to match _across_ hard line breaks, you probably do not 
> want to use it here since that's why the above pattern is matching the whole 
> snippet.
> 
> 
> Regards,
> 
> Patrick Woolsey
> ==
> Bare Bones Software, Inc.             <https://www.barebones.com/>
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <https://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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/F4F3F31D-1D95-4947-A536-DAB806BE2FB4%40barebones.com.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <https://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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2FA90AD6-0870-4499-9CD8-B43714CCB151%40gmail.com.

Reply via email to