Problem with regex
kanishknishar last edited by
This is my text:
I. Allegro (in B-flat major and in sonata form) II. Tema con variazioni (Andante) (theme and 6 variations, where the theme and all the variations are in F major) III. Menuetto - Trio (in B-flat major and in ternary form, trio in G minor) IV. Adagio (in E-flat major and in sonata form) V. Menuetto - Trio (in B-flat major and in ternary form, trio in E-flat major) VI. Andante - Allegro molto (in B-flat major, beginning with an introductory instrumental recitative, and in sonata rondo form)
I want to remove all the text that is in parentheses. I wrote a simple regex for it: https://regex101.com/r/z57nQC/1 and it works too (except the last) but when I try it on Notepad++ it finds no matches. What’s going on?
Terry R last edited by Terry R
and it works too (except the last) but when I try it on Notepad++ it finds no matches. What’s going on?
Your regex is looking ONLY for
\nwhereas normally you would use
\r\nwhich refers to carriage return AND line feed, or
\Rwhich means any type of line ending,
\r\nis the normal line ending in a Windows TXT file.
However the last line will not have these so I’d change your current
$which means end of line, just before the carriage return and line feed. By not selecting the actual line endings you don’t need to return it as a replacement.
PS you could even use this version of your regex if all the closing brackets finish the line