I'm trying to replace a string in jenkins pipeline using groovy script the string is
input : prakash/annam/devops
expected output : prakash/\annam/\devops
I'm using this sed -i 's#/#/\#g' . Unfortunately it is working in shell scripting but not in jenkins pipeline. Please give me a solution.
'prakash/annam/devops'.replaceAll("/", "/\\\\")
will do what you want. Refer here: https://stackoverflow.com/a/6377310/3355860
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