A possibility would be to use the substring function, like this:
If (vmname.substring(0,5) == 'test-') {
with 0 begin the starting index and 5 the end index.
ok so changed it to
The only thing I am missing now is the string comparison basically I am not sure what the syntax is when matching a wildcard.
So I am expecting something similar to
for (i in allVMs){
var vmname = allVMs[i].name
System.log (vmname)
If (vmname = 'test-' + *) {
System.log('Match found!' + vmname)
//Do some stuff
}{
System.log('Does no match ' + vmname)
//Do Nothing
}
I seem to be slipping up on the wildcard part - does anyone know what the syntax would be for that line to match a pattern with a wildcard at the end. I expected it would include * but I think it is now just seeing * as a character.
A possibility would be to use the substring function, like this:
If (vmname.substring(0,5) == 'test-') {
with 0 begin the starting index and 5 the end index.