check if string is uuid

Solutions on MaxInterview for check if string is uuid by the best coders in the world

showing results for - "check if string is uuid"
Fabiana
04 Jun 2016
1// For test 01234567-9ABC-DEF0-1234-56789ABCDEF0 use Regex
2Regex reg = new Regex("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/");
3
4// with brackets
5Regex reg = new Regex("/^\{?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}?$/");
6// use https://regexr.com/ for a REGEX builder