Created
June 12, 2020 17:30
-
-
Save ppazos/d46d7586ce382a7cb4669100da28cec0 to your computer and use it in GitHub Desktop.
Replaces all characters that are not letters or numbers with an underscore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inputs = [ | |
'hola', | |
'hola Carola', | |
'~a`b!c@d#e$f%g@#$%^&^h&i*j(k)l_m+n=o-p' | |
] | |
inputs.each { | |
println it.replaceAll(/[^a-zA-Z0-9]+/,'_') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment