A
A
Anton2018-08-17 13:07:50
Regular Expressions
Anton, 2018-08-17 13:07:50

Regular - how to escape quotes?

Good afternoon.
In Notepad++ in HTML, you need to find and replace quotes for all attributes with quotes with a screen, of course, and preserving the
Essence value, so that it turns out like this:

It was
<meta name="format-detection" content="telephone=no">
  <meta name="robots" content="noodp, noydir">
  <meta name="HandheldFriendly" content="true">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
It became
<meta name=\"format-detection\" content=\"telephone=no\">
  <meta name=\"robots\" content=\"noodp, noydir\">
  <meta name=\"HandheldFriendly\" content=\"true\">
  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">

Tried in the search: ="(.*)"
To replace: =\\"$1\\"
As a result, it turns out that it works only 1 time per line, i.e. if the tag has more than one attribute, it sets the first one to open and the last one to close
What happened in the end (palm face)
:
<meta name=\"format-detection" content="telephone=no\">
  <meta name=\"robots" content="noodp, noydir\">
  <meta name=\"HandheldFriendly" content="true\">
  <meta http-equiv=\"X-UA-Compatible" content="IE=edge\">

Lack of knowledge to fix this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Decadal, 2018-08-17
@Eridani

="(.*)"
here is an error. The idea is this:
https://regexr.com/3u369
replace the dot with the expression "alphabetic characters".
And even better - to negate the double quote.
I don’t know what regexp notepad++ uses, it seems to have its own quirks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question