Loading ...
Sorry, an error occurred while loading the content.

24127RE: Re: [Clip] REGEX Search Backward

Expand Messages
  • nullclip
    Nov 2, 2013
    • 0 Attachment

      Yes.  Your regex together with the W option fixes the issues associated with start location.  There remains one hassle.  For example, say the following URL is the last URL in the text.


      http://www.logicalchess.com/


      The regex finds and highlights only www.logicalchess.com/ instead of the full http://www.logicalchess.com/.

      My objective is to find and fully highlight the last URL in a list of URLs where the URLs can start with either http or www.


      ---In ntb-clips@yahoogroups.com, <ntb-clips@yahoogroups.com> wrote:

      nullclip@... wrote:
      > The work-around is to put the cursor at the start of the
      > document or outline topic's text before beginning the search
      > for the last URL.

      Sorry, I can't reproduce that. So far I had only followed the thread
      without trying anything myself but I just ran John's clip on one of my
      HTMLs and it worked out of the box as advertised.

      Two small points:
      As per the help file the "A" is meaningless here, it is only applicable
      for ^!Replace. The relevant part for finding the last occurrance is the
      greedy dot after the \A.
      A slight niggle is that the closing quotes are included while the
      opening ones aren't. John has already posted the correction.

      By the way, as the "W" makes the search start at the beginning of the
      file anyway and the dot doesn't look for anything specific, the \A is
      superfluous here.

      This leaves me with

      ^!Find "(?s).+\K(https?://|www\.)[^\x20"\r\n<>]+" IORSW

      and it doesn't matter where in the files the cursor sits to begin with.

      Axel
    • Show all 25 messages in this topic