Search code examples
groovyjmeterjmeter-plugins

How to validate a valid GUID in Jmeter using groovy script?


This is the valid GUID 04a8b9f1-4a92-f21c-94f9-1544fa539f44 and i want to validate it. Thanks.


Solution

  • I have solved the above issue.

    String valid = "04a8b9f1-4a92-f21c-94f9-1544fa539f44";
            if (valid .matches("[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"))
            {
                return true;
            }
            else
            {
                return false;
            }