I have strings as below.
ABC//DEG//IJK//LMN//OPQ//rstuvwxyz
BCA//EGD//JKI//MNL//PQO//stuvwxyzr
ACB//DGE//IJK//LNM//OQP//rstuvwxyz
ABC//DEG//IJK//LMN//OPQ//rstuvwxyz
CAB//GDE//KIJ//NLM//QOP//rstuvwxyz
BAC//EDG//JIK//MLN//POQ//rstuvwxyz
I want it to be like this,
ABC//DEG//IJK\\LMN//OPQ//rstuvwxyz
BCA//EGD//JKI\\MNL//PQO//stuvwxyzr
ACB//DGE//IJK\\LNM//OQP//rstuvwxyz
ABC//DEG//IJK\\LMN//OPQ//rstuvwxyz
CAB//GDE//KIJ\\NLM//QOP//rstuvwxyz
BAC//EDG//JIK\\MLN//POQ//rstuvwxyz
I have tried
Find what ^.+?\K//
Replace with: \\\\
But this will only change the first occurrence of slash,,,
And I have tried this,
Find what: ^.+\K//
Replace with: \\\\
And this will replace the final slash at the end of every lines ..
I tried also {3} curly brackets with numbers, but no benifits....
Thanks in advance for your helps....
You can use
^(?:.*?\K//){3}
Replace with \\\\. See the regex demo online.
Details:
^ - start of a line(?:.*?\K//){3} - three occurrences of any zero or more chars other than line break chars, as few as possible, then \K (match reset operator) discards all the text matched so far and then // substring is only kept in the match value.See the demo and settings screenshot:

If you have only uppercase chars A-Z as in the example data, you can use a character class [A-Z]+
^(?:[A-Z]+//){2}[A-Z]+\K//
^ Start of string(?:[A-Z]+//){2} Repeat 2 times matching uppercase chars A-Z and //[A-Z]+\K// Match 1+ uppercase chars A-Z, clear the match buffer and match //Regex demo
In the replacement use \\\\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With