我无法编写正则表达式,所以我真的需要你的帮助才能满足要求。我已经如此接近,但它总是在小事上失败。 这是我试过的最新正则表达式:
/^\\{2}[-\w]+\\(([^"*/:?|<>\\,;[\]+=.\x00-\x20]|\.[.\x20]*[^"*/:?|<>\\,;[\]+=.\x00-\x20])([^"*/:?|<>\\,;[\]+=\x00-\x1F]*[^"*/:?|<>\\,;[\]+=\x00-\x20])?)\\([^"*/:?|<>\\.\x00-\x20]([^"*/:?|<>\\\x00-\x1F]*[^"*/:?|<>\\.\x00-\x20])?\\)*$/
但最终我不允许我在服务器名称中加点。
我需要接受这个:
\\servername.withdot\alowing spaces\1.2.3.4\under_scores\andNotEndWithBackslash
我会接受任何帮助,
由于
答案 0 :(得分:0)
您可以尝试:
const regex = /^\\\\(?!\.)[\w\/\.-]+\\[a-zA-Z0-9 ]+\\(?!\.)[\d\.]+(?!\.)(\\\w+)+$/;
const str = `\\\\servername.withdot\\alowing spaces\\1.2.3.4\\under_scores\\andNotEndWithBackslash`;
console.log(regex.test(str))
*{
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
}
body,html{margin:0px; padding:0px;}
.header {
background-color: grey;
height: 30px;
position:fixed; /* setting to be at top always */
width:100%; /* fix pposition will require a width to occupy space */
}
.container {
display: flex;
}
.nav {
color: white;
background-color: black;
width: 7rem;
position:fixed; /* position fix to keep it on position */
top: 30px; /* equal to height of header */
}
.sticky-nav {
height: calc(100vh - 30px); /* calculating height according to browser height subtracting the top height of header*/
overflow-y: scroll;
}
.content {
background-color: #ccc;
width: 100%;
padding:5px;
padding-left:7rem; /* padding left = width of 7rem*/
margin-top:30px;
}
&#13;