本帖最后由 Nsqs 于 2017-3-8 07:29 编辑
- ' 2>nul&cls&type "a.txt"|cscript -nologo -e:vbs "%~0">new.txt&exit
- set regexp=new regexp
- set ws=wsh.stdin
- with regexp
- do
- .global=-1
- read=ws.readline
- .pattern="\b\w{8,}$"
- if .test(read) then
- .pattern="\b(\d+|[a-zA-Z][a-zA-Z]+)$"
- if not .test(read) then
- .pattern="^.* (.*)$"
- r=.replace(read,"$1")
- .pattern="([A-Z].*|.*[A-Z].*)"
- if not .test(r) then
- .pattern="(^[a-z]+)(.*)"
- a=.replace(r,"$1")
- b=.replace(r,"$2")
- .pattern="\d*"
- s=.replace(a,empty)
- p=ucase(left(s,1))&right(s,len(s)-1)
- read=replace(read,r,replace(r,s,p))
- end if
- wsh.echo read
- end if
- end if
- loop until ws.atendofstream
- end with
复制代码
|