R
R
Roman Govorov2022-01-14 17:16:51
Regular Expressions
Roman Govorov, 2022-01-14 17:16:51

How to replace a specific string with a regular expression?

There are lines:

url(../img/repeat-elements/tpl-action-section_bg-1200.png) no-repeat 50%/1200px;
url(../img/pages/home/what-is_bg-1400.png) no-repeat 100% 50%/500px;
url(../img/blog/action/action_1-1400.png) no-repeat 100% 50%/500px;


I need to replace the paths, I've already broken my head with these regular expressions ...
I need to insert VALENOK instead of the path up to the last / inclusive ...
61e1877dce848119494922.png

The result will be like this:
<code lang="html">
ВАЛЕНОКtpl-action-section_bg-1200.png) no-repeat 50%/1200px;
ВАЛЕНОКwhat-is_bg-1400.png) no-repeat 100% 50%/500px;
ВАЛЕНОКaction_1-1400.png) no-repeat 100% 50%/500px;
</code>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2022-01-14
@RGameShow

https://regex101.com/r/aLofBY/1
https://regex101.com/r/aLofBY/2

S
Shellr57s, 2022-01-24
@Shellr57s

https://regex101.com/r/dUTU61/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question