W
W
weslyg2016-09-27 15:21:36
PowerShell
weslyg, 2016-09-27 15:21:36

How to form RegExp for replace?

There is a line in the file
'dmY' => '23-12-2010',
everything after the => symbol can change, but it will be in '' and there will be a comma at the end
Task:
Without knowing what will be on the right side of the line, replace this with a certain variable.
Essentially, I'm sending a string and saying take the first double quotes, and replace with the second ones (static for now)
"'db_name' => 'powerShell' " -replace "'db_name' => '\w+',", "GUI"
Returns original. I fought, I can't. I checked everything I could regexr.com https://regex101.com/ regexstorm.net/tester
Everywhere RegExp works, I thought I made double quotes - the result is 0.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2016-09-27
@lazalu68

Maybe so:
(?<==> ')(.*)(?=')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question