On Fri, 8 Jun 2018, Grant Taylor wrote:

On 06/08/2018 05:36 PM, RW wrote:
It can be done if you capture inside a lookahead. For example:

Intriguing.

Indeed.

body  X_EQUALS_Y   /^(?=.*X=(\d+)\b).*Y=\1\b/

Can I ask that you unpack that Regular Expression?  Please.

I'm apparently too rusty to unpack it myself.

Apparently: (?=...) is true if it matches anywhere after that point, but it is a zero width assertion. So it matches if it occurs in the ".*" prior to the Y bit, and it also matches if it occurs *after* the Y bit. The cool part is it includes a capture, so it will pull out matching text before *or* after the Y bit that can be used in the rest of the expression...

Learn something new every day.

I will have to play with that and see if I can simplify some of my multiple-header-match rules and get from-in-subj to work regardless of the header order.

Thanks!

--
 John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
 jhar...@impsec.org    FALaholic #11174     pgpk -a jhar...@impsec.org
 key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  A superior gunman is one who uses his superior judgment to keep
  himself out of situations that would require the use of his
  superior skills.
-----------------------------------------------------------------------
 435 days since the first commercial re-flight of an orbital booster (SpaceX)

Reply via email to