win7自带的正则表达式验证工具----powershell


  最近项目中要用正则表达式,忽然想起powershell可以啊...
  用了一下,很爽...
  下面给个例子
  $str = 'eax=77431182 ebx=7ffd8000 ecx=00000000 edx=00123689 esi=00000000 edi=00000000'
  $str1 = 'eip=00123689 esp=0023f7e4 ebp=0023f7ec iopl=0         nv up ei pl zr na pe nc'
  $str -match 'eax=([0-9a-f]{8}) ebx=([0-9a-f]{8}) ecx=([0-9a-f]{8}) edx=([0-9a-f]{8}) esi=([0-9a-f]{8}) edi=([0-9a-f]{8})'
  $matches
  输出
  6                              00000000                                                                       
  5                              00000000                                                                       
  4                              00123689                                                                       
  3                              00000000                                                                       
  2                              7ffd8000                                                                       
  1                              77431182                                                                       
  0                              eax=77431182 ebx=7ffd8000 ecx=00000000 edx=00123689 esi=00000000 edi=00000000
  -match是正则验证,类似regex_search
  验证完,将结果放在全局变量$matches中

你可能感兴趣的:(powershell)