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

regEx help ... all except

Expand Messages
  • Don
    I want to capture stuff into a () set ... ;Random Stuff A ; I want everything between the semi-colons except the A . That may be any letter between A and
    Message 1 of 2 , Feb 7, 2012
    • 0 Attachment
      I want to capture stuff into a () set ...
      ;Random Stuff 'A';
      I want everything between the semi-colons except the " 'A'". That may
      be any letter between A and Z between the single quotes.

      Currently I look for this as I know it will never be more than 49
      characters there:
      ;(.{1,49});

      But that includes the 'A' in it. So if I use $1 I get the 'A'.

      There may or may not be a 'LETTER' at the end of the string. So if
      there is none, I want to capture all between the ; and if present
      capture all but the space, single quote, capital letter, single quote
      (that always is at the very end).
    • Don
      Seems to work, I think: ;(?(?=.{1,49} [A-Z] )(.{1,49}) [A-Z] |(.{1,49})); I named the captured substrings ...
      Message 2 of 2 , Feb 7, 2012
      • 0 Attachment
        Seems to work, I think:
        ;(?(?=.{1,49} '[A-Z]')(.{1,49}) '[A-Z]'|(.{1,49}));

        I named the captured substrings ...

        On 2/7/2012 9:27 PM, Don wrote:
        > I want to capture stuff into a () set ...
        > ;Random Stuff 'A';
        > I want everything between the semi-colons except the " 'A'". That may
        > be any letter between A and Z between the single quotes.
        >
        > Currently I look for this as I know it will never be more than 49
        > characters there:
        > ;(.{1,49});
        >
        > But that includes the 'A' in it. So if I use $1 I get the 'A'.
        >
        > There may or may not be a 'LETTER' at the end of the string. So if
        > there is none, I want to capture all between the ; and if present
        > capture all but the space, single quote, capital letter, single quote
        > (that always is at the very end).
      Your message has been successfully submitted and would be delivered to recipients shortly.