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

Re: [Clip] Re: reworking data

Expand Messages
  • Don
    Interesting -- a new regex I have not seen before. Either beginning or double return? A only ever matches at the start of the string. Likewise, Z only ever
    Message 1 of 27 , Sep 6, 2011
      Interesting -- a new regex I have not seen before.

      Either beginning or double return?

      \A only ever matches at the start of the string. Likewise, \Z only ever
      matches at the end of the string. These two tokens never match at line
      breaks. This is true in all regex flavors discussed in this tutorial.

      \K is?

      On 9/7/2011 12:36 AM, diodeom wrote:
      > ;Capture header values of a single table
      > ^!Find "(\A|\R\R)\w.+\R\K.+" RS
    • Don
      Actually I think this is ultimately a much better solution. Having extra columns if correctly labelled is no problem as I ll then order as needed discarding
      Message 2 of 27 , Sep 6, 2011
        Actually I think this is ultimately a much better solution. Having
        extra columns if correctly labelled is no problem as I'll then order as
        needed discarding the empties.

        On 9/7/2011 12:36 AM, diodeom wrote:
        > On a margin of the general issue (as I chose to see it out of selfish interest: enforcing conformity on inconsistently structured/ordered tables piled up in one document), again, I imagine that it's more practical to spot among your data a predictible and manageable set of variances to accomodate by individualized code -- instead of blanket restructuring I exercised above.
      • Alec Burgess
        ... GIYF (Google is your friend) [regex K ] http://www.phpfreaks.com/blog/pcre-regex-spotlight-k ... Don, IIRC you use Regex Buddy? - if not ignore the
        Message 3 of 27 , Sep 6, 2011
          On 2011-09-07 00:52, Don wrote:
          >
          > \K is?
          GIYF (Google is your friend) [regex "\K"]
          http://www.phpfreaks.com/blog/pcre-regex-spotlight-k
          > One escape sequence that doesn’t get much attention is \K. What this
          > handy sequence does is resets the starting point of the reported
          > match. Any previously matched characters are not included in the final
          > matched sequence.

          Don, IIRC you use Regex Buddy? - if not ignore the following:

          unfortunately this useful escape sequence isn't (yet) supported by Regex
          Buddy. Its essentially equivalent to a positive lookbehind but allows
          variable length wildcards which are not supported by PCRE (any version
          AFAIK) but are supported in flavors JGSoft and dotNet.

          ie. > ^!Find "(\A|\R\R)\w.+\R\K.+" RS could be simulated in RegexBuddy
          by matching:
          (?<=(\A|\R\R)\w.+\R)\K.+(?<=(\A|\R\R)\w.+\R).+
          ie. remove the \K but wrap everything up to it with (?<=.....) (and of
          course change the \R's back to \r\n since Regex Buddy also doesn't
          support these yet either.

          Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)
        • Don
          Correct and of course I looked there. It also doesn t support R in the PCRE flavor as you go on to mention. Still love RegexBuddy I might add ... even
          Message 4 of 27 , Sep 6, 2011
            Correct and of course I looked there. It also doesn't "support" \R in
            the PCRE flavor as you go on to mention. Still love RegexBuddy I might
            add ... even with a few limits here and there.

            But now I have to figure out what ?<= is doing ... did you just leave
            out closing parenthesis figuring I'd just know where they go?

            I never feel so stupid as when I do regex with you, dio and flo (and
            Sheri ... when she pops in now and again). But I sure try to grasp
            them. I've learned a lot and still feel miles behind :-)

            On 9/7/2011 1:48 AM, Alec Burgess wrote:
            > Don, IIRC you use Regex Buddy? - if not ignore the following:
          • Alec Burgess
            ... Sorry, I had a typo. I left out a new-line in my response: ie. ^!Find ( A| R R) w.+ R K.+ RS could be simulated in RegexBuddy by matching:
            Message 5 of 27 , Sep 7, 2011
              On 2011-09-07 02:35, Don wrote:
              > But now I have to figure out what ?<= is doing ... did you just leave
              > out closing parenthesis figuring I'd just know where they go?
              I wrote:
              > ie. > ^!Find "(\A|\R\R)\w.+\R\K.+" RS could be simulated in RegexBuddy
              > by matching:
              > (?<=(\A|\R\R)\w.+\R)\K.+(?<=(\A|\R\R)\w.+\R).+
              > ie. remove the \K but wrap everything up to it with (?<=.....) (and of
              > course change the \R's back to \r\n since Regex Buddy also doesn't
              > support these yet either.
              Sorry, I had a typo. I left out a new-line in my response:
              ie. > ^!Find "(\A|\R\R)\w.+\R\K.+" RS could be simulated in RegexBuddy
              by matching:
              (?<=(\A|\R\R)\w.+\R).+ (ie turn everything BEFORE the "\K" by putting
              it inside (?= ... leave what was there ... then match opening bracket
              by closing end bracket )

              ie. remove the \K but wrap everything up to it with (?<=.....) (and of
              course change the \R's back to \r\n since Regex Buddy also doesn't
              support these yet either.

              Note: you can do this in RegexBuddy by pasting the (works in NTB
              expression): (\A|\R\R)\w.+\R\K.+ in the Match box, then select
              everything up to but not including the \K, right click on it then select
              [Insert token] then go down to [Lookaround] and on its pop-out select
              [Positive lookbehind]. Then remove the \K now unneeded at the end and
              change the \R's to \r\n's.

              I am always forgetting the exact syntax of the four lookaround options
              myself and often open up RB just to allow it to substitute the one I
              want :-[

              Hopefully that makes it clear but if not, in RegexBuddy - Help -
              Tutorial (index) checkout: Lookahead, Lookaround, Lookbehind topics.
              With that, you s/b able to test the clip code that Diodem posted. (I
              haven't done so)

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