我不能为我的生活找到适当的正则表达式.
我正在寻找的是匹配Linux文件权限的有效数字表示的正则表达式(例如,740表示全部读取,777表示全部全部).到目前为止,我已经尝试了以下内容:
strtotest=740
echo "$strtotest" | grep -q "[(0|1|2|3|4|5|7){3}]"
if [ $? -eq 0 ]; then
echo "found it"
fi
Run Code Online (Sandbox Code Playgroud)
与上面的问题是,正则表达式匹配任何事1-5或7在里面,不管在任何其它字符.例如,如果strtotest要更改为709,则条件为真.我也试过了[0|1|2|3|4|5|7{3}],[(0|1|2|3|4|5|7{3})]但那些效果不好.
我正在使用正则表达式错误,还是我错过了必须处理的内容grep?
我一直在阅读新的HTML5元素及其适当的用法,目前有一些这样的标记:
<article>
<h1>Crazy Awesome Programming Projects</h1>
<article>
<h2>Mathematics</h2>
<section>
<h3>Binary to Decimal converter</h3>
<p> info here </p>
</section>
<section>
<h3>Scientific Calculator</h3>
<p> info here </p>
</section>
</article>
<article>
<h2>String Manipulation</h2>
<section>
<h3>RSS Feed Generator</h3>
<p> info here </p>
</section>
<section>
<h3>Palindrome Detector</h3>
<p> info here </p>
</section>
</article>
</article>
Run Code Online (Sandbox Code Playgroud)
<article>以这种方式嵌套标签在语义上是否正确?提前致谢