Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need to come up with a regex to look for only letters A, F or E on the position 9 of a given text. I am really new with regex, did some searching and couldn't find any similar response. what i have so far is:

/^.{9}A/

This command seems to work to find letter A on the space nine, but how can I add the other 2 letters to the regex?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

You say you're looking for C, F or E but looking for A in your example, so please include in the brackets any other letters you want to match, but what you're looking for is:

/^.{8}[CFE]/

It should be {8} rather than {9} because the way you had it, it'll match the first 9 characters and then match your letter in position 10.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...