Guid Regex

ZM 211 Reputation points
2022-04-06T14:45:59.697+00:00

hi i would like some help to validate a pattern before releases

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Givary-MSFT 35,621 Reputation points Microsoft Employee Moderator
    2022-04-07T06:20:21.263+00:00

    @SakeriyeMohamud-4520

    Thank you for reaching out to us.

    As i understand you are looking for regex to validate this pattern "04e01ea8-c88a-4835-a4ed-0db65ea31dbd"

    Researched and tested in my lab, find the below regex to validate the same.

    "04e01ea8-c88a-4835-a4ed-0db65ea31dbd" -match '(?im)^[{(]?[0-9A-F]{8}[-]?(?:[0-9A-F]{4}[-]?){3}[0-9A-F]{12}[)}]?$'

    190861-image.png

    Reference:
    https://www.geeksforgeeks.org/how-to-validate-guid-globally-unique-identifier-using-regular-expression/
    https://tech.nicolonsky.ch/validating-a-guid-with-powershell/

    Let me know if you have any questions.

    Please remember to "Accept Answer" if answer helped, so that others in the community facing similar issues can easily find the solution.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.