S
S
sashatop2021-01-28 00:39:42
Regular Expressions
sashatop, 2021-01-28 00:39:42

How to replace using regular expressions in Notepad++?

There is an xml file like this:

<quantity>0</quantity>
            <stock>Под заказ</stock>
            <available>false</available>
            <param name="Диаметр колес">16"</param>
            <param name="Размер рамы">10,5"</param>
            <param name="Рама">высокопрочная сталь "High tensile steel"</param>
            <param name="Руль">Сталь 520мм, с защитной накладкой</param>


You need to use regular expressions throughout the document to replace
<param name="Диаметр колес">16"</param> на <diametr>16"</diametr>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2021-01-29
@ForestAndGarden

Find: <param name=\"Диаметр колес\">(.*?)<\/param>
Replace with:<diametr>$1</diametr>

D
dollar, 2021-01-28
@dollar

This is done in two steps:

  1. First replace everything </param>with </diametr>- it's easy.
  2. Then replace <param[^>]*>with <diametr>. It doesn't seem to be difficult either. Just do not forget to indicate in the replacement window (Ctrl + H) that the search string is considered exactly as a regular expression (there is a checkmark).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question