How to match IP address by using 'findstr'? Or any other method of batch in windows

前端 未结 5 1410
广开言路
广开言路 2021-01-21 07:30

    As the title said, I want to match ip address with batch in windows, please tell me how I can do it?
    I see that \"finds

5条回答
  •  星月不相逢
    2021-01-21 08:37

    FINDSTR is the only native batch utility that has any support for regular expressions. But the support is very limited and non-standard. The only repeat expression supported is *. In addition, it is limited to a maximum of 15 character class terms (see What are the undocumented features and limitations of the Windows FINDSTR command?). So I don't think it is possible to develop a native batch regex that will precisely match an IP address.

    You could stay within native windows utilities and use Power Shell, or you could use JScript or VBScript via the CSCRIPT command. All three have much better regex support.

    Alternatively you could download any of a number of Windows ports of Unix utilities, many of them free. GnuWin32 is a good resource (includes grep): http://gnuwin32.sourceforge.net/

提交回复
热议问题