Board logo

标题: [文本处理] 批处理命令findstr怎么查找不包含/并且包含.的内容? [打印本页]

作者: 522235677    时间: 2014-6-11 11:39     标题: 批处理命令findstr怎么查找不包含/并且包含.的内容?

就是如果包含小数点并且不包含斜杠那成立。

http://as.com   这个不合法

as.com  这个合法

as  这个不合法

http://as  这个不合法


用批处理这个长时间了,findstr都不会,深表惭愧
作者: terse    时间: 2014-6-11 12:45

  1. findstr /vc:"/" |findstr /c:"."
复制代码

作者: 522235677    时间: 2014-6-11 12:50

回复 2# terse


    看样只能查找两次了,我以为能一次查找完成呢
作者: apang    时间: 2014-6-11 12:51

这样呢?
  1. echo,http://as.com|findstr/be "[^/]*\.[^/]*">nul&&echo,ok||echo,nok
复制代码

作者: 522235677    时间: 2014-6-11 13:21

本帖最后由 522235677 于 2014-6-11 13:22 编辑

回复 4# apang


    再问一个,查找包含@并且包含.

或者能不能检测邮箱格式是否合法
作者: apang    时间: 2014-6-11 14:43

回复 5# 522235677


    判断邮箱的话,这样也许能行
  1. @echo off
  2. set "re=[a-z0-9\-_][a-z0-9\-_]*"
  3. echo,abc@163.com|findstr /ibe "%re%@%re%\.%re%">nul&&echo,ok||echo,nok
  4. pause
复制代码

作者: 522235677    时间: 2014-6-11 15:41

回复 6# apang


    再问你一个低级的问题,怎么允许空格符号啊。因为我要输入的是多个账号,用空格分开的。




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2