Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#901 Extend Regular expressions (part2)

open
nobody
None
5
2012-11-13
2007-12-14
Interstellar
No

It would be nice to also have these expressions:

| (pipe)
Causes the regex engine to match either the part on the left side, or the part on the right side. Can be strung together into a series of options. abc|def|xyz matches abc, def or xyz
The pipe has the lowest precedence of all operators. Use grouping to alternate only part of the regular expression. abc(def|xyz) matches abcdef or abcxyz

{n}
where n is an integer >= 1 Repeats the previous item exactly n times. a{3} matches aaa

{n,m}
where n >= 1 and m >= n Repeats the previous item between n and m times. Greedy, so repeating m times is tried before reducing the repetition to n times. a{2,4} matches aa, aaa or aaaa

{n,m}?
where n >= 1 and m >= n Repeats the previous item between n and m times. Lazy, so repeating n times is tried before increasing the repetition to m times. a{2,4}? matches aaaa, aaa or aa

{n,}
where n >= 1 Repeats the previous item at least n times. Greedy, so as many items as possible will be matched before trying permutations with less matches of the preceding item, up to the point where the preceding item is matched only n times. a{2,} matches aaaaa in aaaaa

{n,}?
where n >= 1 Repeats the previous item between n and m times. Lazy, so the engine first matches the previous item n times, before trying permutations with ever increasing matches of the preceding item. a{2,}? matches aa in aaaaa

Discussion

  • I think this highly needed feature will never implemented
    Arrrrrgh

     
  • I would also love to request this regular expression functionality along with the other basic regex features in 1185698 [http://sourceforge.net/tracker/index.php?func=detail&aid=1185698&group_id=95717&atid=612385]

    1. Support for shorthand character classes such as \w,
    \d, \s and the negated \W, \D, \S. E.g. \w being
    synonymous with [a-zA-Z0-9_]. Saves a LOT of typing ;-
    ). See http://www.regular-
    expressions.info/charclass.html

    2. Support for the optional "?" operator to denote 0 or 1
    matches of the preceding regexp. Example "</?([a-zA-
    Z0-9]+)>". See http://www.regular-
    expressions.info/optional.html

    3. Support for multi-line operation (the ability to have a
    regular expression that spans multiple text lines).
    Possibly implemented via a "multi-line" checkbox.See
    http://www.regular-expressions.info/modifiers.html

    4. Support for word boundary \b. See http://www.regular-
    expressions.info/wordboundaries.html

    5. Support for greedy/lazy matching via the the *? and
    +? operator. See http://www.regular-
    expressions.info/repeat.html

     
  • David Gausmann
    David Gausmann
    2011-01-29

    I want regular expressions like PCRE, too.
    Is this more a political problem than a technical problem?

     
  • Andrew Brown
    Andrew Brown
    2011-07-06

    Does anyone know anything about how RegEx is handled in the source? I'd love to help out on this issue since I love NP++ and was sorely disappointed to see these features were not implemented yet.

     
  • Tao Klerks
    Tao Klerks
    2012-04-13

    support for all these features was added in Notepad++ 6.0, with
    perl-compatible regular expressions library support. Can this issue be
    closed?