我正在尝试使用包含管道字符的正则表达式进行 grep |
。但是,它没有按预期工作。如下图所示,正则表达式与|
inclusively不匹配。
这是我的 bash 命令
cat data | grep "{{flag\|[a-z|A-Z\s]+}}"
样本数据如下
| 155||NA||{{flag|Central African Republic}}||2.693||NA||0.000||0.000||0.019||0.271||0.281||0.057||2.066
|{{flagicon|Kosovo}} ''[[Kosovo]]'' <ref name="KOS" group=Note>{{Kosovo-note}}</ref>
|{{flagicon|Somaliland}} [[Somaliland|Somaliland region]]
|{{flagicon|Palestine}} ''[[Palestinian Territories]]''{{refn|See the following on statehood criteria:
Run Code Online (Sandbox Code Playgroud)
预期的输出是
| 155||NA||{{flag|Central African Republic}}||2.693||NA||0.000||0.000||0.019||0.271||0.281||0.057||2.066
Run Code Online (Sandbox Code Playgroud)
但是,使用Regex101.com对其进行测试后,结果如预期。