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

Re: [Clip] Re: [NTB] Stripping text up to a given character

Expand Messages
  • Don - HtmlFixIt.com
    Yes that answers my question. I didn t know if once invoked it followed or continued invoked or if you did it one at a time, etc. I also might have still
    Message 1 of 5 , Jun 7, 2009
    • 0 Attachment
      Yes that answers my question. I didn't know if once invoked it
      "followed" or continued invoked or if you did it one at a time, etc. I
      also might have still called "three" $3 or maybe $5 because the middle
      one took up three places. Cleared up a lot of questions. As always,
      thanks.

      Don

      Sheri wrote:
      > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
      >> Interesting. If I have a three pattern search, can I disable the
      >> capture one by one?
      >>
      >> So if I have (one)(two)(three) and then I only want to capture
      >> one and three I could go (one)(?:two)(three).
      >>
      >> Which if I put the three repeat as you did ... in the middle
      >> (one)(?:two){3}(three) would avoid the unnecessary capture?
      >>
      >> Notice I took this off of the notetab list and dumped it in clips
      >> ...
      >> maybe should have gone off topic? Is regex on or off topic? :-)
      >
      > LOL, Per our charter: "We hope to use the regular list for basic NoteTab "How to" questions and other NoteTab assistance in general. The NoteTab Clips List is to be used for the Clips and more advanced topics like RegExp."
      >
      > So Thanks to Jody, Regex is ontopic here :D
      >
      > I'm not sure I understand your question, but any time you use ?: for a group, it causes that group to be non-capturing. You must then skip that set of parentheses for counting groups to retrieve by number. So if you have:
      >
      > (one)(?:two){3}(three)
      >
      > where matched, "one" would be in $1 and "three" would be in $2.
      >
      > Regards,
      > Sheri
    • ebbtidalflats
      ... Thanks for clearing that up. One question remains. Does this carry into a nested parentesis? Would (one)(?:two(four)){3}(three) bring the same result as in
      Message 2 of 5 , Jun 7, 2009
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
        >
        > I'm not sure I understand your question, but any time you use ?: for a group, it causes that group to be non-capturing. You must then skip that set of parentheses for counting groups to retrieve by number. So if you have:
        >
        > (one)(?:two){3}(three)
        >
        > where matched, "one" would be in $1 and "three" would be in $2.


        Thanks for clearing that up. One question remains. Does this carry into a nested parentesis?


        Would (one)(?:two(four)){3}(three) bring the same result as in your above example?


        TIA


        Eb
      • Sheri
        ... You would need ?: in the (four) group to avoid capturing it. Because it is inside a repeating group, it is useless when captured imo. (four) would be in $2
        Message 3 of 5 , Jun 7, 2009
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...> wrote:
          >
          > --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@> wrote:
          > >
          > > I'm not sure I understand your question, but any time you use ?: for a group, it causes that group to be non-capturing. You must then skip that set of parentheses for counting groups to retrieve by number. So if you have:
          > >
          > > (one)(?:two){3}(three)
          > >
          > > where matched, "one" would be in $1 and "three" would be in $2.
          >
          >
          > Thanks for clearing that up. One question remains. Does this carry into a nested parentesis?
          >
          >
          > Would (one)(?:two(four)){3}(three) bring the same result as in your above example?
          >
          >
          > TIA
          >
          >
          > Eb
          >

          You would need ?: in the (four) group to avoid capturing it. Because it is inside a repeating group, it is useless when captured imo. (four) would be in $2 and would contain the last "four" in the third occurrence of twofour in:

          onetwofourtwofourtwofourthree

          You can test it by running
          ^!Replace "(one)(?:two(four)){3}(three)" >> "*$2*" RSA2

          against document text:
          onetwofourtwofourtwofourthree
          onetwofourtwofourtwofourthree
          onetwofourtwofourtwofourthree

          Regards,
          Sheri
        Your message has been successfully submitted and would be delivered to recipients shortly.