Search code examples
regexnotepad++

Notepad++ Copy one character between lines


Hope you can help me with this...

I have this data file where it's

The correct answer is A. and the reason for that answer is ....
ANSWER: 
The correct answer is B. and the reason for that answer is ....
ANSWER: 
The correct answer is C. and the reason for that answer is ....
ANSWER: 
The correct answer is D. and the reason for that answer is ....
ANSWER: 

I need someway to copy the letter A or B .. etc to the Answer: line

The correct answer is A
ANSWER: A
The correct answer is B
ANSWER: B
The correct answer is C
ANSWER: C
The correct answer is D
ANSWER: D

Can this be done? to only grab the letter without the dot.? Thanks

edit: adding the missing info. sorry about that


Solution

  • Using Regex

    Find:

    is (.)(.*)\r\nANSWER:
    

    Replace

    is \1\2\r\nANSWER: \1
    

    enter image description here