How to write a search pattern to include a space in findstr?

后端 未结 4 1484
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 20:02

I want to search all files in a certain directory for occurrences of statements such as

  Load frmXYZ

I am on Windows 7, using the f

4条回答
  •  爱一瞬间的悲伤
    2020-12-29 20:13

    This piece of code will only allow letters, numbers, underscore and white space in keyword:

    set /p keyword="Enter keyword: " || Set keyword=
    
    set keyword_replaced=%keyword: =_%
    
    echo %keyword_replaced%| findstr /r "[^0-9a-zA-Z_]" > nul
    if errorlevel 1 goto noexit
    echo special characters in keyword not allowed (except space and _), TERMINATING
    timeout 4
    exit /b 0
    :noexit
    

提交回复
热议问题