如何匹配任何字符串但不匹配以斜杠开头的字符串?
how to match any string but not a string that starts with slash?
如何匹配任何字符串但不匹配以斜杠开头的字符串?
我正在使用节点 js 正则表达式
这是我的尝试,但没有成功
(?!\/s).*
您可以使用 startsWith
函数:
if(!str.startsWith('/')) // true for your case
^[^\/]
匹配除了以斜杠开头的所有内容
^[^\/].*
如果要匹配整个字符串
如何匹配任何字符串但不匹配以斜杠开头的字符串?
我正在使用节点 js 正则表达式
这是我的尝试,但没有成功
(?!\/s).*
您可以使用 startsWith
函数:
if(!str.startsWith('/')) // true for your case
^[^\/]
匹配除了以斜杠开头的所有内容
^[^\/].*
如果要匹配整个字符串