On Mon, 5 Jan 2015, Bowie Bailey wrote:

On 1/5/2015 4:13 PM, John Hardin wrote:
 On Mon, 5 Jan 2015, Bowie Bailey wrote:

> You can avoid having to escape the slash (/) by using a different > separator for the regex. This can avoid "leaning toothpick syndrome." > > For example:
>    m#http://match/this/url/#

 Ouch. # won't work for that (in SA at least) as it comments out the rest
 of the RE.

Ack! Forgot about that minor difference with SA. # is my general go-to character for that in normal Perl scripts.

This should illustrate the same point with the minor improvement of actually *working* in SA:
  m^http://match/this/url/^

I tend to avoid using symbols that are syntactically significant in REs for that purpose. In your example, you can't then anchor the RE at the beginning of the URL because ^ has been repurposed as the RE delimiter.


--
 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
-----------------------------------------------------------------------
  The social contract exists so that everyone doesn't have to squat
  in the dust holding a spear to protect his woman and his meat all
  day every day. It does not exist so that the government can take
  your spear, your meat, and your woman because it knows better what
  to do with them.                           -- Dagny @ Ace of Spades
-----------------------------------------------------------------------
 12 days until Benjamin Franklin's 309th Birthday

Reply via email to