Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-20 Thread @lbutlr
On 19 Oct 2018, at 16:26, F. Alfredo Rego wrote: > That was a lame joke (to attempt to convey the power of regexes, Never joke about the power of regex!  -- Two of the most famous products of Berkeley are LSD and Unix. I don't think that is a coincidence -- This is the BBEdit Talk public

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-19 Thread F. Alfredo Rego
That was a lame joke (to attempt to convey the power of regexes, for better or for worse) and I’m sorry if I scared you ;-) > On Oct 19, 2018, at 4:23 PM, Christopher Stone > wrote: > > On 10/19/2018, at 17:14, F. Alfredo Rego > wrote: >> P.S. >> Your previous

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-19 Thread Christopher Stone
On 10/19/2018, at 17:14, F. Alfredo Rego mailto:f.alfredor...@gmail.com>> wrote: > P.S. > Your previous suggestion had a slightly undesired side effect: It erased all > of my backups, locally and in the Cloud. Other than this minor inconvenience, > it was a good exercise ;-) Hey Alfredo,

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-19 Thread F. Alfredo Rego
Hey Chris, This works like magic! I even tried variable-length patterns and everything works perfectly, without having to deal with the frustratingly annoying limitations of negative loo-behind & Co. Thank you very much. I’m sure many in this group will benefit from your successfully crafted

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-19 Thread Christopher Stone
On 10/13/2018, at 12:26, F. Alfredo Rego mailto:f.alfredor...@gmail.com>> wrote: > Did you mean to use the same name for both patterns? Hey Alfredo, No. That was a goof up. I also misplaced a character. Try this: ^(?>(?:(?!ostracized_string).))*wanted_string.*$ -- Best Regards, Chris --

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-13 Thread F. Alfredo Rego
Hi Patrick, The special case “fixed-length specific string” is perfect. So, I rephrase: Dear engine, Here are some lines: Some stuff of no interest whatsoever ostracized_stringwanted_string ostracized_string wanted_string ostracized_string with Some stuff and then

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-13 Thread Patrick Woolsey
On Oct 13, 2018, at 13:26, F. Alfredo Rego wrote: > >> On Oct 13, 2018, at 12:08 AM, Christopher Stone >> wrote: >> >> On 10/12/2018, at 16:03, F. Alfredo Rego wrote: >>> >>> I would like to craft an expression to find lines that contain pattern_2 >>> NOT preceded by pattern_1 >>> (with

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-13 Thread F. Alfredo Rego
Hey Chris, How about this? Dear engine: Please look for pattern_2 in the current line. If the current line DOESN’T CONTAIN pattern_2, great. Skip this line and try the next line. However, if the current line CONTAINS pattern_2: Does the current line ALSO

Re: Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-13 Thread Christopher Stone
On 10/12/2018, at 16:03, F. Alfredo Rego mailto:f.alfredor...@gmail.com>> wrote: > I would like to craft an expression to find lines that contain pattern_2 NOT > preceded by pattern_1 > (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2). Hey Alfredo, It's a best-practice to

Grep: pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2)

2018-10-12 Thread F. Alfredo Rego
Hello everyone. I would like to craft an expression to find lines that contain pattern_2 NOT preceded by pattern_1 (with pattern_1 not necessarily IMMEDIATELY to the left of pattern_2). This is the catch, so let me repeat it with emphasis on IMMEDIATELY: with pattern_1 not necessarily