0

I have several lines like this:

Apples
__________
B
C

Bananas
___________
D
E

Carrots
____________
F 
G

I would like to make it so that Apples, bananas, and carrots are each their own separate heading in html. So I would like to do a regex search for 3 consecutive underscores or more and then insert html heading tags in the line preceding it. Can someone tell me how to do this with Notepad++ regex search and replace?

1 Answer 1

2

Search for

(^|\n)(.*)([\n\r]+)(_{3,})([\n\r]|$)

and replace it with

$1<h1>$2</h1>$5

enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

I've tried both of the previous suggestions in regex and extended, and it cannot find relevant text. What am I doing wrong?
@Ωmega: Maybe OP's having a problem with line breaks and carriage returns. But apart from that your expression should be fine. +1 P.S. you should change your username because it's second to impossible to refer to you. It may seem fancy but it would be better if it started with a standard letter
If it's a problem with line breaks and carriage returns, how do I fix that? I think that has screwed me up once before.
@user964946 - Use (^|\n)(.*)([\n\r]+)(\s*_{3,})([\n\r]|$). You have there probably some extra spaces.
Thank you everyone for their input! I guess what's wrong is on my end :/ I'll keep at it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.