Check if a field string start with a determinate string

Try this:

def path = doc['myField'].value;
if (path != null) {
    int loc = path.indexOf('edi');
    if (loc == 0) {
      return 'EDI';
    }
}
return null;

The myField field must be a keyword type (or use myField.keyword if you have the multi-field).

Personally, if the field is going to either be a certain value or not, I would probably return Booleans from my script, and call the field isEdi