2

How to capture strings between two words/characters either or both words have multiple occurrences but I want the words both from the first column.

1. A-Hi hello C-0987654321 
2. B-Zzzzzzzzzzzz D-Hi
3. C-I want to go to Europe C- Nexy year D-I wish so 
4. D-Are
5. E-You
6. F-Test
7. G-Test
8. H-Test
9. I-Test
10.J-Test

Desired Capture: C-I want to go to Europe C- Nexy year D-I wish so

I used regex \C-.+\D- but it captures C-0987654321 B-Zzzzzzzzzzzz

I want to capture between lines 3.C- and 4.D-(all from first column) which is “ C-I want to go to Europe C- Nexy year D-I wish so”

1 Answers1

2

Using Notepad++


  • Ctrl+F
  • Find what: C-.+D-.+
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Find Next

Explanation:

C-      # literally C and hyphen
.+      # 1 or more any character but newline
D-      # literally D and hyphen
.+      # 1 or more any character but newline

Screenshot:

enter image description here

Toto
  • 19,304