0

Here is my text:

<h3>#6</h2>
Is he eating a lemon?

</div>

I have a few of them in my articles the #number is always different also the text is always different.

I want to make this out of it:

<h3>#6 Is he eating a lemon?</h3>

I tried it via regex in notepad++ but I am still very new to this:

My Search:

<h3>.*?</h2>\r\n.*?\r\n\r\n</div> 

Also see here.

Now it is always selecting the the right part of the text.

How does my replace command need to look like now to get an output like above?

2
  • your regex pattern right now is doubled. Is that a typo? Commented Jul 20, 2016 at 14:37
  • that is a typo, sorry for that Commented Jul 20, 2016 at 14:39

2 Answers 2

1

You should modify your original regex to capture the text you want in groups, like this:

<h3>(.*?)</h2>\r\n(.*?)\r\n\r\n</div>
    (   )         (   ) 
//  ^             ^     These are your capture groups

You can then access these groups with the \1 and \2 tokens respectively.

So your replace pattern would look like:

<h3>\1 \2</h3>
Sign up to request clarification or add additional context in comments.

Comments

0

Your search could be <h3>(.*)<\/h2>\r\n(.*)\r\n\r\n<\/div> and the replace is <h3>$1 $2</h3>, where $1 and $2 represent the strings captured in the parentheses.

Comments

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.