Forum Discussion
radhika1
8 years agoContributor
hi,
Please find attached the samples.
bagochips
8 years agoContributor
// Iterate through your nodes grabbing the value of each tag you are needing to validate and check for the acceptable patterns. Assert pass or failure accordingly
a = "alDMMKG-JJG'Haja" // passes for all acceptable patterns
b = "sliuugie3jksl" // fails for a number in the string
c = "-ksaieJKLU" // fails for begining with a special character
// this will look for all of the acceptable characters are present and if something else appears then you can assert a failure
if (a ==~ /^[a-zA-Z-']+$/) {
log.info "pass"
}else{
log.info "fail"
}
// this will look at the first digit for non alpha characters and will fail if anything other than an alpha character appears at the beginning of the string
if ( a.take(1) ==~ /^[a-zA-Z]+$/) {
log.info "pass"
}else{
log.info "fail"
}