Check if string is following a specific pattern in Go [closed]

  Kiến thức lập trình

I am trying to create a check to ensure a user inputted string matches a pattern with 3 letters and a string separate by a dash with spaces.

An example would be

XXX - customer platform

where XXX stands for any 3 capital letters. There has to be a space after the dash but otherwise any string could fit at the end.

I found that matching a regular expression to a string could work for this but have no idea how to write out the regex for it.

New contributor

Nick Millison is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

LEAVE A COMMENT