Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #26044
    David
    Participant

    I’m trying to capture several groups within a string using a regex. However once I reach greater than 9 back-references, they do not replace as I expected.

    Eg: This is a bit of a contrived example.

    Input string: abcdefghijklmnopqrstwhj
    Find What: ^(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)$
    Replace With: \10

    It doesn’t work. I also try $10, \g<10>, \$+10…..but failed. Does EmEditor support back references more than 9?

    #26046
    Yutaka Emura
    Keymaster

    Currently, EmEditor doesn’t support backreferences more than 9. If this is important, I will see if I can improve it.

    #26047
    David
    Participant

    It’s hard to say it’s important or not. Most case, 9 is enough. Occasionlly I need more.
    For my current case, I use “batch replace all” function to resolve it and get successful.

    During looking for help from Google, I saw someone mentioned Notepad++ support more than 9.

    #26048
    Mr KT
    Participant

    Yes please, can I second this request. Also, if at all possible, if named groups could be used as named backreferences for replace, that would be fantastic.

    e.g. (Just a simple example but: ideally extended to more than 9 capture groups)

    Find: (?<day>\d\d)(?<month>\d\d)(?<year>\d\d\d\d)

    Replace: \k<year>\k<month>\k<day>

    #26096
    Yutaka Emura
    Keymaster

    EmEditor v19.1 beta 1 (19.0.91) supports backreferences more than 9 by using this form: $10, $11, $12, … We will release it shortly.

    #26109
    David
    Participant

    ありがとう;Thank You;고맙습니다;谢谢;DANKE.
    Thanks for your quick response.

    #26115
    Mr KT
    Participant

    Thanks Yutaka,
    $n seems to work great. Is it possible to implement named groups for Find and Replace, if the engine used is Onigmo? From the documentation (https://github.com/k-takata/Onigmo/blob/master/doc/RE), it seems as though it is supported?

    e.g: Section 8. Backreferences
    \k<name> \k’name’ backreference a group with the specified name

    #26121
    Yutaka Emura
    Keymaster

    The next version supports named capturing group by using this form: (?<name>expression) and named backreference by using this form: \k<name>.
    Thank you!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.