On Sat, 2 Mar 2013, Wolfgang Zeikat wrote:

In an older episode, on 2013-03-02 02:40, John Hardin wrote:

> > header __MANY_RECIPS ToCc =~ /(?:\@[^@]{5,30}){3}/ > > Can someone explain the regex and why it fails to fire for 7 recipients?

 (@, followed by 5-30 non-@ characters) repeated three times.

Does that mean the same sequence of (@, followed by 5-30 non-@ characters), repeated 3 times?

The *same* sequence, no. Matching a repeating specific sequence would involve capturing the match (using parens without the ?:) and backreferences to refer to the capruted match later in the RE; it would look something like:

  /(\@[^@]{5,30})\1{2}/

--
 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
-----------------------------------------------------------------------
  So Microsoft's invented the ASCII equivalent to ugly ink spots that
  appear on your letter when your pen is malfunctioning.
         -- Greg Andrews, about Microsoft's way to encode apostrophes
-----------------------------------------------------------------------
 12 days until Albert Einstein's 134th Birthday

Reply via email to