Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Regex conundrum

$
0
0

I am looking to replace a particular string with another, but only if it occurs between delimiters, and other text that does not get replaced also could exist between the delimiters. So replacing XXXX with ZZZZ and the delimiter is %...
this 
%XXXX YYYY% XXXX
becomes
%ZZZZ YYYY% XXXX

Neither the extra text between the delimiters nor the target text outside the delimiters is affected. It seems like this should be doable with regular expressions, but all I can seem to manage is everything between the delimiters.

Gordon



Viewing all articles
Browse latest Browse all 21975

Trending Articles