Matching characters in a string based on its position

I'm curious if it is possible to get some help building a regEx that can check for matches of letter placement against incoming strings. For instance, lets say I had 'f' in the first character, 'o' in the second and so on... then validate that as I loop strings.

Hopefully this makes sense! Please let me know if you need any more details! Thanks!

ps. This is all in plain ol' ASCII.


Edit:

To be more clear about the character position matching, for instance, if I had a pattern of:

- e - p

I'd like to be able to have the string of 'derp' match as true (since it's hitting the second and fourth characters).

Answers


any word character

*e?p -> \w+e\wp

or any aplha

*e?p -> [a-z]+e[a-z]p

and for 4 characters

any word character

?e?p -> \we\wp

or any aplha

?e?p -> [a-z]e[a-z]p

UPDATE

Use the above patterns to create more specific matches where * and ? are dos like. For example:

mis?i?n -> mis[a-z]i[a-z]n

*i?n -> [a-z]+i[a-z]n

The first one will match "mission" and the second one will match "mission" and "passion" and "fashion"...


Change your hyphens to dots:

^.e.p$

A dot means match any character apart from new line.


this is possibly the fifth easiest regex to construct. If you want to match a specific string in positions 0 through 4 (say) of an input string and the letters you want to match are 'abcde', then the following regex does the trick:

/^(abcde)/ 

Need Your Help

How can i set keywords or (similar information) per page on pdf?

pdf adobe metadata

i have a pdf it has almost 300-400 pages.I want to set information about per page.