I need to restrict what a user can enter into a field based on previous entries that are already in the system.
For instance, the user has already entered these values into the database:
["typescript", "C#", "python"]
If they type one of these existing values exactly into the input field, I want a validation message to appear.
I found a negative look-ahead Regex that somewhat works:
^(?!.*(typescript|C#|python)).*$
However, it will trigger validation error if any of those words appear anywhere in the input string (for example: "pythons" would trigger the error). I only want it to fail if one of those words appears exactly as entered.
UPDATE
I opted for the custom validator solution provided below. The regex approach also worked but validators were deemed more appropriate for this specific issue.