Regular expressions match characters for specific locations

I need to come up with a regular expression to find only the letters A, F or E in the 9th digit of a given text. I am new to regex and did some searching, but I can’t find it To any similar reply. What I have so far is:

/^.{9}A/

This command seems The letter A can be found in space 9, but how to add the other 2 letters to the regular expression?

You said you are looking for C, F or E, but in your example you are looking for A, So please add any other letters you want to match in the brackets, but what you are looking for is:

/^.{8}[CFE]/< /pre> 

It should be {8} instead of {9}, because the way you have it, it will match the first 9 characters, and then match your letter at position 10.

I need to come up with a regular expression to find only the letters A, F or E in the 9th position of a given text. I am new to regex and did some searching and couldn't find any Similar response. What I have so far is:

/^.{9}A/

This command seems to work The letter A is found on space 9, but how to add the other 2 letters to the regular expression?

You said you are looking for C, F or E, but you are looking for A in your example, so please put whatever you want to match in the parentheses Other letters, but what you are looking for is:

/^.{8}[CFE]/

It should be {8} Instead of {9}, because the way you have it, it will match the first 9 characters and then match your letter at position 10.

Leave a Comment

Your email address will not be published.