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

Re: [NTS] Re: regular expression to find anything up to two spacesin a row ...

Expand Messages
  • Axel Berger
    ... I think I said so at the time. What my solution cared for was 1) The find may be more than one line. 2) Double spaces may or may not occur, if not select
    Message 1 of 3 , Jun 22, 2011
    • 0 Attachment
      Don wrote:
      > What I am trying to do is use two spaces as a delimiter in
      > essence. I will actually be discarding the spaces as
      > unnecessary in what I am doing.

      I think I said so at the time. What my solution cared for was
      1) The find may be more than one line.
      2) Double spaces may or may not occur, if not select until the end of
      file.
      3) There may be more than two spaces in a row.
      4) There may be more than one valid find in a file.
      5) If there is more than one find and there are more than two spaces,
      discard all of them, i.e. do not start the second find with the third
      space.

      For all of these conditions you can relax in your special case, you can
      make my suggestion so much simpler.

      N.B: Working with all kinds of files from all kinds of sources I have
      little control over is one of my main uses of clips. I learnt to expect
      everything and be as general as possible the hard way. My clips keep
      growing as I dicover ever more and newer traps and snares and unintended
      side effects.

      Axel
    • Don
      Thanks Axel, I did respond to much of that right away, but I guess missed the may or may not occur part -- they will always occur on each line or the line
      Message 2 of 3 , Jun 22, 2011
      • 0 Attachment
        Thanks Axel, I did respond to much of that right away, but I guess
        missed the "may or may not occur" part -- they will always occur on each
        line or the line will be skipped, so it is not multiline (#1 removed),
        #2 removed, always exists, #3 is true but I'm just trying to terminate
        this field so no matter on them, #4 is true, should be one per line,
        won't be two, #5 falls as a results of #4 :-)

        I really appreciate your time and that of all the others. I have
        learned a great deal from this one "simple" question, even if mal-formed
        and insufficiently detailed at the start.

        I have been using regex buddy more and more (used to just use regex
        coach) and it is teaching me to also write regex with thought to what I
        don't want maybe even more than what I do want. One of their first
        examples highlights this and points out that you may not need to be as
        careful if you have pre-validated and properly formed data -- in your
        case you had neither :-)


        On 6/22/2011 11:22 AM, Axel Berger wrote:
        > Don wrote:
        >> What I am trying to do is use two spaces as a delimiter in
        >> essence. I will actually be discarding the spaces as
        >> unnecessary in what I am doing.
        >
        > I think I said so at the time. What my solution cared for was
        > 1) The find may be more than one line.
        > 2) Double spaces may or may not occur, if not select until the end of
        > file.
        > 3) There may be more than two spaces in a row.
        > 4) There may be more than one valid find in a file.
        > 5) If there is more than one find and there are more than two spaces,
        > discard all of them, i.e. do not start the second find with the third
        > space.
        >
        > For all of these conditions you can relax in your special case, you can
        > make my suggestion so much simpler.
        >
        > N.B: Working with all kinds of files from all kinds of sources I have
        > little control over is one of my main uses of clips. I learnt to expect
        > everything and be as general as possible the hard way. My clips keep
        > growing as I dicover ever more and newer traps and snares and unintended
        > side effects.
        >
        > Axel
      • Alec Burgess
        ... RegexBuddy is great. I can never remember the syntax for the four lookaround patterns and often open it up just for that :-) One caveat - the version of
        Message 3 of 3 , Jun 22, 2011
        • 0 Attachment
          On 2011-06-22 11:31, Don wrote:
          > I have been using regex buddy more and more (used to just use regex
          > coach) and it is teaching me to also write regex with thought to what I
          > don't want maybe even more than what I do want.
          RegexBuddy is great. I can never remember the syntax for the four
          lookaround patterns and often open it up just for that :-)
          One caveat - the version of PCRE they use/emulate(?) is a couple behind
          the latest which Sheri and Eric have been keeping current.

          The two that I would most like to see are \R (easy to workaround - use
          \r\n) and \K - once I finally figured out how this works in Notetab I
          sometimes have to code the regex a little less easily in RegexBuddy.

          Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)
        Your message has been successfully submitted and would be delivered to recipients shortly.