I am trying to implement similar functionality of change directory (cd) in command prompt.
The restriction is that,
1 . directory names must only contain alphabets.
2 . root directory is "/"
3 . parent directory is ".."
4 . path separator is "/"
The input will be the new path name .
Input might be like .
1. directory name alone. - valid
2. directory/directory/directory - valid
3. directory//directory - invalid
4. .. - valid
5. directory/.. - valid
6. directory/... - invalid
and other combinations like that.
To avoid complexity I tried to split the check
- To check input must contain only letters, I used ^[A-Za-z]+$ this.
- But don't know how to restrict the / and dot(.) characters subsequent occurences to 1 and 2 respectively
Thanks