Groovy web console

subscribe to the feed Subscribe
to this
site

dreaded-substitution

Published 6 months ago by Anonymous
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def jql = '[a AND b] OR [c]'

println jql.replace('[', '\\\\[').replace(']', '\\\\]')


println jql.replaceAll(/[\[\]]/, '\\\\\\\\\$0')