P
P
PageUp2021-08-13 12:30:19
Notepad++
PageUp, 2021-08-13 12:30:19

How to replace part of a string and leave part of a string?

61163904dd258034824331.png

Hello, the screenshot shows what I'm trying to do, but it doesn't work for me. What needs to be done so that in all files the value of locs / * .dat (* - in different files has different variables - $go, $data_P[1], $locS_DATA[3], etc.)

Replace with a function like locs( "*")

, that is, change LOCS to: ".locs, then change the sign / to an opening bracket with a quote (" then again leave everything unchanged until .dat and change the ending: .dat to a quote with a closing bracket, after which a period with quote: ")."

In general, the text should be replaced with a function. Replace text locs/any variable.dat" with ".locs("any variable")."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
js-newbie, 2021-08-13
@PageUp

Search Mode: Регулярные выражения
Search: locs/(.*)\.dat"
Replace:".locs\("\1"\)."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question