Skip to content

Instantly share code, notes, and snippets.

@ppazos
Created June 12, 2020 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppazos/559c8caf11da5a4b46e410db8e8ac052 to your computer and use it in GitHub Desktop.
Save ppazos/559c8caf11da5a4b46e410db8e8ac052 to your computer and use it in GitHub Desktop.
Checks if the template id matches our normalized format just checking the ending
def regex = /.*\.([a-z]{2})\.v([0-9]+[0-9]*(\.[0-9]+[0-9]*(\.[0-9]+[0-9]*)?)?)$/
def input = [
'c_o_v_i_d-19_pneumonia_diagnosis_and_treatment_(7th_edition)_en_v1_en_v1.en.v1',
'Cualequier Cosa.es.v1',
'Cualequier Cosa.es.v234.234',
'Cualequier Cosa.es.v234.234.234',
'`1234567890-=~!@#$%^&*(){}"|>?><,./;[].en.v1',
'asdasda.v1'
]
input.each {
if (it.matches(regex))
{
println "matches"
}
else
{
println "no match"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment