Searching for a Regex to disable any "/" before the first letter -


i got angular form upload files on cloud, files in directories subdirectories

"directory/subdirectory/filename"

my form had inputs, , added ng-pattern on text input.

i can't accept sentence "/" @ first character

/directory/subdirectory/filename

i searching regex deny "/" until first letter of directory name.

so, correct way is:

directory/blabla;

and wrong way is:

/directory/blabla;

i tried [^/]* detect '/' in sentence.

any idea please ?

this should do: ^[^\/]\s+$

the regex checks first character not '/', , accepts every non-whitespace character till end.

demo


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -