I need to make regex for java language which :
- does not ends or starts with space
- contains latin letters
- contains numbers
- contains «–», «_», «,», «.», «(», «)», «\», «/» ,« »(space)
- lenght from 1 to 255 I have tried:
^[^\s][a-zA-Z0-9-_,. ()\\\/]+[^\s]$
^[a-zA-Z0-9\\-_,. ()\\\\/][a-zA-Z0-9\\-_,. ()\\\\/ ]{0,253}[a-zA-Z0-9\\-_,. ()\\\\/]$
but they does not matches strinds with one char like "a" or "/" Also i know that i cant pass into my api in json like : "test" : "" because it throws exception that json is invalid, so i tried "\" but id does not matches. Help me plese !