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

Regular expression

Expand Messages
  • Bogdan AXINIA
    Hello, I want to ask for your help for a regular expression for Javascript. I want to determine there or more consecutive occurrences for same character in a
    Message 1 of 4 , Mar 2, 2005
    View Source
    • 0 Attachment
      Hello, I want to ask for your help for a regular expression for
      Javascript. I want to determine there or more consecutive occurrences
      for same character in a string. For example I want determine
      occurrence for `aaa' or `xxx' or `bbbbb'. Thanks a lot !
    • Jagdishwar B
      It is not possible in editplus because in the find expression we cannot determine the previous character after cursor passes to the next character. you can
      Message 2 of 4 , Mar 2, 2005
      View Source
      • 0 Attachment
        It is not possible in editplus because in the find expression we
        cannot determine the previous character after cursor passes to the
        next character.

        you can separately find out whether it contains aaa or bbb*, etc
        i feel we cannot write the generalized expression to find aaa, bbb, xxx etc,

        Jagdishwar


        On Wed, 02 Mar 2005 10:19:55 -0000, Bogdan AXINIA <augustin@...> wrote:
        >
        >
        > Hello, I want to ask for your help for a regular expression for
        > Javascript. I want to determine there or more consecutive occurrences
        > for same character in a string. For example I want determine
        > occurrence for `aaa' or `xxx' or `bbbbb'. Thanks a lot !
        >
        > http://www.editplus.com
        > http://groups.yahoo.com/group/editplus
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
      • jaguarcy
        True. If you were performing regular expressions in lie php, then it would be a matter of lookahead. I guess tho that in editplus you could search for each
        Message 3 of 4 , Mar 2, 2005
        View Source
        • 0 Attachment
          True. If you were performing regular expressions in lie php, then it
          would be a matter of lookahead. I guess tho that in editplus you could
          search for each sequence explicitly. I.e. use the OR operator and
          search for:

          aaa+|bbb+|ccc+|ddd+|eee+|fff+...... you get the idea. And since
          regexps are greedy, they'd only get the full set of consecutive
          characters (3 or more), meaning that if the string 'ffffff' exists in
          your text, it will choose the whole sting and won't stop as soon as it
          hits the first 3 f's.

          --- In editplus@yahoogroups.com, Jagdishwar B <bjagdishwar@g...> wrote:
          > It is not possible in editplus because in the find expression we
          > cannot determine the previous character after cursor passes to the
          > next character.
          >
          > you can separately find out whether it contains aaa or bbb*, etc
          > i feel we cannot write the generalized expression to find aaa, bbb,
          xxx etc,
          >
          > Jagdishwar
          >
          >
          > On Wed, 02 Mar 2005 10:19:55 -0000, Bogdan AXINIA <augustin@o...> wrote:
          > >
          > >
          > > Hello, I want to ask for your help for a regular expression for
          > > Javascript. I want to determine there or more consecutive occurrences
          > > for same character in a string. For example I want determine
          > > occurrence for `aaa' or `xxx' or `bbbbb'. Thanks a lot !
          > >
          > > http://www.editplus.com
          > > http://groups.yahoo.com/group/editplus
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
        • jaguarcy
          A full regexp to detect patterns of consecutive letters would be something like: /([a-z]) 1{2,}/i which uses a backreference, not lookahead as I said. Haven t
          Message 4 of 4 , Mar 2, 2005
          View Source
          • 0 Attachment
            A full regexp to detect patterns of consecutive letters would be
            something like:

            /([a-z])\1{2,}/i

            which uses a backreference, not lookahead as I said.

            Haven't tested the regexp, but it looks right.
            These should also do the same thing:

            /([a-z])\1\1+/i
            /([a-zA-Z])\1{2,}/

            --- In editplus@yahoogroups.com, "jaguarcy" <jaguarcy@g...> wrote:
            >
            > True. If you were performing regular expressions in lie php, then it
            > would be a matter of lookahead. I guess tho that in editplus you could
            > search for each sequence explicitly. I.e. use the OR operator and
            > search for:
            >
            > aaa+|bbb+|ccc+|ddd+|eee+|fff+...... you get the idea. And since
            > regexps are greedy, they'd only get the full set of consecutive
            > characters (3 or more), meaning that if the string 'ffffff' exists in
            > your text, it will choose the whole sting and won't stop as soon as it
            > hits the first 3 f's.
            >
            > --- In editplus@yahoogroups.com, Jagdishwar B <bjagdishwar@g...> wrote:
            > > It is not possible in editplus because in the find expression we
            > > cannot determine the previous character after cursor passes to the
            > > next character.
            > >
            > > you can separately find out whether it contains aaa or bbb*, etc
            > > i feel we cannot write the generalized expression to find aaa, bbb,
            > xxx etc,
            > >
            > > Jagdishwar
            > >
            > >
            > > On Wed, 02 Mar 2005 10:19:55 -0000, Bogdan AXINIA <augustin@o...>
            wrote:
            > > >
            > > >
            > > > Hello, I want to ask for your help for a regular expression for
            > > > Javascript. I want to determine there or more consecutive
            occurrences
            > > > for same character in a string. For example I want determine
            > > > occurrence for `aaa' or `xxx' or `bbbbb'. Thanks a lot !
            > > >
            > > > http://www.editplus.com
            > > > http://groups.yahoo.com/group/editplus
            > > > Yahoo! Groups Links
            > > >
            > > >
            > > >
            > > >
            > > >
          Your message has been successfully submitted and would be delivered to recipients shortly.