S
S
Sapiker2020-05-02 22:17:11
Regular Expressions
Sapiker, 2020-05-02 22:17:11

How do I copy text from a comment and paste it into the tag below it?

How can I copy text from a comment to a tag?

<!-- EN: Text1 -->
<Tag1.label>Text2</Tag1.label>
<!-- EN: Text3 -->
<Tag2.label>Text4</Tag2.label>


It should turn out:
<!-- EN: Text1 -->
<Tag1.label>Text1</Tag1.label>
<!-- EN: Text3 -->
<Tag2.label>Text3</Tag2.label>


The comment is always one line above the target tag, but there can be different text between them.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-05-02
@Sapiker

Find: <!-- EN:\h*+(.*?)\h*-->\s*<\w+\.label>\K[^<>]+
Replace: $1
https://regex101.com/r/xz3PHD/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question