1

I have this link (HTML Links - Hyperlinks)

<p class="mb-40px"><a href="my-name-is-prince.html"></a></p>

I want to import the content from link, copy it, and put it again in front of </a> ?

The Output should be:

<p class="mb-40px"><a href="my-name-is-prince.html">My Name Is Prince</a></p>

My regex is almost good, can copy the link from o place to another, but I don't know how to get off the connecting line

FIND: (<p class="mb-40px"><a href=")(.*?)(.html">)(</a>)

REPLACE BY: \1\2\3\u\2\4

2 Answers 2

1

Such job can be done with PythonScript plugin in Notepad++


If it is not yet installed, follow this guide

  • Create a script (Plugins >> PythonScript >> New Script)
  • Copy this code and save the file (for example format.py):
import re

def format(match):
    lab = re.sub('-', ' ',match.group(2)).title()
    return match.group(1) + lab

editor.rereplace('(<p class="mb-40px"><a href="(.*?)\.html">)', format)
  • Open the file you want to modify
  • Run the script (Plugins >> PythonScript >> Scripts >> format)
  • Done

Result for given example:

<p class="mb-40px"><a href="my-name-is-prince.html">My Name Is Prince</a></p>
1
  • It works. Super answer, @Toto. You always have best answers. THANKS !
    – Just Me
    Feb 19, 2022 at 13:46
1

My solution consists of two steps:

Step 1:

  • Find: (<p class="mb-40px"><a href=")(.*?)(.html">)(</a>)
  • Replace By: \1\2\3\u\2\4

Step 2.

  • Find: (?-s)(\G(?!^)|html">)((?!</a).)*?\K[-]
  • Replace By: \x20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .