I'm trying to create a regex that matches the first 3 characters of a string,
If I have the string ABCFFFF, I want to check that the first 3 characters are ABC.
It's pretty simple, the template will be ^ABC
^ABC
As others point out, using regular expressions for such a task is redundant. Any regular expression programming language can do this better with simple string manipulation.
A simple regex will work:
/^ABC/
But this is a good use case for regex, I'm not sure. Consider using substring in any language / platform that you are using.
substring
"^ ABC" should work. '^' matches the beginning in most regular expression implementations.