https://bugs.kde.org/show_bug.cgi?id=365124

            Bug ID: 365124
           Summary: Regex capture groups for text fails beyond \9
           Product: kate
           Version: 3.14.3
          Platform: Ubuntu Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: nealky...@gmail.com

Regex capture groups for text fails beyond \9, but works for numbers. In other
words, \10 is interpreted as capture group \1 with 0 appended. But for numbers
it is correctly interpreted as capture group \10

To demonstrate, here are some examples.

(with numbers, works correctly)

text:
1 2 3 4 5 6 7 8 9 10 11 12 13

regex:
^([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)
([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)$

replace with:
\1::\2::\3::\4::\5::\6::\7::\8::\9::\10::\11::\12::\13

result:
1::2::3::4::5::6::7::8::9::10::11::12::13

(with text, does not work)

text:
one two three four five six seven eight nine ten eleven twelve thirteen

regex:
^(.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*)$

replace with:
\1::\2::\3::\4::\5::\6::\7::\8::\9::\10::\11::\12::\13

result:
one::two::three::four::five::six::seven::eight::nine::one0::one1::one2::one3



For the text example, you get the same result even when the regex is:
^([^:]+) ([^:]+) ([^:]+) ([^:]+) ([^:]+) ([^:]+) ([^:]+) ([^:]+) ([^:]+)
([^:]+) ([^:]+) ([^:]+) ([^:]+)$

Reproducible: Always

Steps to Reproduce:
1. Enter text
2. Enter regex
3. Enter replacement
4. Click 'Replace All'

Actual Results:  
one::two::three::four::five::six::seven::eight::nine::one0::one1::one2::one3

Expected Results:  
one::two::three::four::five::six::seven::eight::nine::ten::eleven::twelve::thirteen

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to