Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex findstr正则表达式_Regex - Fatal编程技术网

Regex findstr正则表达式

Regex findstr正则表达式,regex,Regex,我真的很难让正则表达式与findstr一起工作。我在名为filelist.txt的文本文件中有以下内容作为示例 test1 test12 test13 test14 uyt* test16 test19 test47 nam; help367 file1 named665 我还有一组可接受的字符,它们是a-Z,a-Z,0-9,空格 我想运行findstr并让它返回所有包含不可接受字符的结果,在这种情况下,它应该返回以下内容 **nam; uyt*** 我正在使用以下命令 findstr /r

我真的很难让正则表达式与findstr一起工作。我在名为filelist.txt的文本文件中有以下内容作为示例

test1
test12
test13
test14
uyt*
test16
test19
test47
nam;
help367
file1
named665
我还有一组可接受的字符,它们是a-Z,a-Z,0-9,空格

我想运行findstr并让它返回所有包含不可接受字符的结果,在这种情况下,它应该返回以下内容

**nam;
uyt***
我正在使用以下命令

findstr /r /v "[^a-zA-Z0-9_./-]" filelist.txt
但这与我想要的相反,它显示了所有没有特殊字符的条目。我尝试用/v代替/x来显示匹配项,但这不会返回任何结果

有人能帮忙吗?

试试:

findstr /b /e /r /v /C:"[a-zA-Z0-9_ ./-]*" filelist.txt


尝试了这两个命令,都没有返回任何内容对不起,我的错误,第一个命令返回所有值,第二个命令返回novalues@ightstarr20:似乎不喜欢该空间。把括号里的空格去掉就行了。太好了,这次就行了。知道如何包含空间吗?找到了。编辑答案。
findstr /r /x /C:".*[^a-zA-Z0-9_ ./-].*" filelist.txt