V
V
ViolettaPch302022-02-26 00:02:38
Yandex Market Language
ViolettaPch30, 2022-02-26 00:02:38

How to replace one line with another in yml, if each has different numbers?

Hello! Can you tell me how to replace the data of one row with another?
6219435267207485224348.png
Rearrange numbers from vendorCode to offer id=
And there are many such values ​​WITH DIFFERENT NUMBERS in files.
I tried formulas in NotePad++ 621943dc13eba624747815.png, but it just inserts text, not numbers.
It would be desirable for me to replace only the numbers so that it turns out like this:
6219434850569085176781.png
Help, please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dasolod, 2022-02-26
@ViolettaPch30

The general concept is that you need to find all this in one query, and then perform a replacement using the substring statements found.
If you show by example, then you need to replace
(<offer id=")(.*)(".*<vendorCode>)(.*)(<)
with
\1\4\3\4\5
Main do not forget to include "and new lines"
Or if you prefer a picture:
62194e3424fdd796908283.jpeg
Each bracket found is numbered from one, and they can be used when "replacing". Here we have separated the code from the offer, and the vendor code, and substituted the second instead of the first, and ourselves.
Tested on this text:

<offer id="12312312321" available = true>
sdfa
asdfas
asdfa
sf
<><<>><><><
<vendorCode>261913</vendorCode>

if something does not work, then it is better to throw your data in text, retyping them for too long.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question