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

Reg Expression Question

Expand Messages
  • T Cosmas
    I need to search through some text to find a string which follows the pattern 3 capital letters + 1 lowercase letter + 3 capital letters. From the way the
    Message 1 of 3 , Jan 6, 2009
    • 0 Attachment
      I need to search through some text to find a string which follows the
      pattern 3 capital letters + 1 lowercase letter + 3 capital letters.
      From the way the problem was stated, I am not sure if the repeating
      characters are all the same so that is why I tried the "+" versions.
      The statement is: "One small letter, surrounded by EXACTLY three big
      bodyguards on each of its sides."

      I've tried

      [A-Z^a-z][A-Z^a-z][A-Z^a-z][a-z][A-Z^a-z][A-Z^a-z][A-Z^a-z]

      [A-Z^a-z]+[a-z][A-Z^a-z]+

      [^a-z]+[a-z][^a-z]+

      But none of them seem to do the job.

      Thanks.
    • dz@caribe.net
      Your regexps are wrong: you cannot mix the range operator ([ ]) with the negative range operator ([^ ]). Try this: ([A-Z][A-Z][A-Z])([a-z])([A-Z][A-Z][A-Z])
      Message 2 of 3 , Jan 6, 2009
      • 0 Attachment
        Your regexps are wrong: you cannot mix the range
        operator ([ ]) with the negative range operator ([^
        ]). Try this:

        ([A-Z][A-Z][A-Z])([a-z])([A-Z][A-Z][A-Z])

        Make sure to set the "Case Sensitive" option "on".

        -dZ.

        >------- Original Message -------
        >From : T Cosmas[mailto:t_cosmas@...]
        >Sent : 1/6/2009 3:19:40 PM
        >To : editplus@yahoogroups.com
        >Cc :
        >Subject : RE: [edit+] Reg Expression Question
        >
        >I need to search through some text to find a string
        which follows the
        pattern 3 capital letters + 1 lowercase letter + 3
        capital letters.
        From the way the problem was stated, I am not sure if
        the repeating
        characters are all the same so that is why I tried
        the "+" versions.
        The statement is: "One small letter, surrounded by
        EXACTLY three big
        bodyguards on each of its sides."

        I've tried

        [A-Z^a-z][A-Z^a-z][A-Z^a-z][a-z][A-Z^a-z][A-Z^a-z][A-Z^a-z]

        [A-Z^a-z]+[a-z][A-Z^a-z]+

        [^a-z]+[a-z][^a-z]+

        But none of them seem to do the job.

        Thanks.


        ------------------------------------

        http://www.editplus.comYahoo! Groups Links
      • Sergio Pereira
        This worked for me: [A-Z][A-Z][A-Z][a-z][A-Z][A-Z][A-Z] If you need the exact same 3 letter sequence on each side, I believe editplus regex parser does not
        Message 3 of 3 , Jan 6, 2009
        • 0 Attachment
          This worked for me:
          [A-Z][A-Z][A-Z][a-z][A-Z][A-Z][A-Z]

          If you need the exact same 3 letter sequence on each side, I believe
          editplus' regex parser does not understand the back references like:

          ([A-Z][A-Z][A-Z])[a-z]\1

          A cleaner expression would be:

          ([A-Z]{3})[a-z]\1

          But editplus does not support the { } yet.

          Hope this helps
          ______________________________________
          Sergio Pereira



          On Tue, Jan 6, 2009 at 1:19 PM, T Cosmas <t_cosmas@...> wrote:
          > I need to search through some text to find a string which follows the
          > pattern 3 capital letters + 1 lowercase letter + 3 capital letters.
          > From the way the problem was stated, I am not sure if the repeating
          > characters are all the same so that is why I tried the "+" versions.
          > The statement is: "One small letter, surrounded by EXACTLY three big
          > bodyguards on each of its sides."
          >
          > I've tried
          >
          > [A-Z^a-z][A-Z^a-z][A-Z^a-z][a-z][A-Z^a-z][A-Z^a-z][A-Z^a-z]
          >
          > [A-Z^a-z]+[a-z][A-Z^a-z]+
          >
          > [^a-z]+[a-z][^a-z]+
          >
          > But none of them seem to do the job.
          >
          > Thanks.
          >
          >
          > ------------------------------------
          >
          > http://www.editplus.comYahoo! Groups Links
          >
          >
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.