Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ドメイン名のないWebURLやLinuxディレクトリなど、パスに一致するものが必要です。something/ like / this / and /allows-dashes
つまり、許可される文字は、数字、アルファベット、ダッシュ、およびスラッシュです。最初と最後の文字をダッシュまたはスラッシュにすることはできません。
私が得ることができる最高のものはこれです
^[a-z0-9]+[a-z0-9(\/)(-)]*[a-z0-9]+$
しかし、それは失敗します
a/b-c/d
- もエスケープする必要があります。以下をお試しください
^[a-z0-9]+[a-z0-9(\/)(\-)]*[a-z0-9]+$