2 Instances In Find & Replace
-
I would like to use Find & Replace with 2 instances, the first instance is straight forward,
Find Z:\ Replace with /share/Public/I would like to introduce a second instance together with the first to all in one pass
replace all the backward slashes to forward slashes
Find \ Replace /Is there anyway to do this or will I have to do it in 2 different F&R
-
Hello JayLaFunk,
Easy enough, with the S/R, below, using the regular expression search mode :
SEARCH =
(?i)(Z:\\)|(\\)and REPLACE =(?1/share/Public/)(?2/)For instance, the two sentences, below :
The absolute path : "C:\Program Files(x86)\7-zip\Lang" The network drive Z:\ contains some public software, for everybodyare changed, in one go, into :
The absolute path : "C:/Program Files(x86)/7-zip/Lang" The network drive /share/Public/ contains some public software, for everybodyNotes :
-
The
(?i)modifier force the insensitive behaviour of the regex engine, even if the match case option is set, in the replace dialog ( Just in case, your text contains the string z:\, with a lowercase drive letter ! ) -
The backslash character have a special meaning, in regexes. So, it must be escaped itself, with an other backslash character, to be taken, literally.
-
The search regex contains two groups : group 1 =
Z:\\and group 2 =\\, between round brackets. -
The replace regex contains two conditional replacement groups :
(?1/share/Public/), which writes the string /share/Public, if group 1 exists and(?2/), which writes a forward slash, if group 2 exists.
Best Regards,
guy038
-
-
Cheers Guy, that worked a treat.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login