How can i validate only certain characters are used

I'm learning to code and i would like to ensure the program does certain things when certain characters are existing.

Ex:

cd C:\Program P1 P2

User will input p1 with something like 3e-2, how can i validate that certain characters are inputted in specific positions, such as no e as first or last character.

Also that p2 always begins with x and the second characters is always between 2-16.

Thanks
Topic archived. No new replies allowed.