回复 1# newuser
#include <array.au3>
Local $str="this is a apple."&@CRLF& _ ;注意多行字符串的定义不要少了 @crlf
"this is a red red apple."&@CRLF& _
"i love regex!"&@CRLF& _
"ilove regular expressions?"&@CRLF& _
"this is a fat"&@CRLF& _
"<very>fat</very> pig."
Local $result=StringRegExp($str,"(?ms)^i.*?\r\n",3)
_ArrayDisplay($result)
Local $result=StringRegExpReplace($str,"(?ms)^i.*?\r\n","")
msgbox(0,0,$result)
;~ ;用指定 空 内容 替换 ((?ms)^i\V+)匹配的内容
;~ ;缺点:被替换处显示对应空行,如何实现删除指定行而不出现空白呢?
Local $str="this is a apple."&@CRLF& _ ;注意多行字符串的定义不要少了 @crlf
"this is a red red apple."&@CRLF& _
"i love regex!"&@CRLF& _
"ilove regular expressions?"&@CRLF& _
"this is a fat"&@CRLF& _
"<very>fat</very> pig."
Local $result=StringRegExp($str,"(?ms)^i.*?(?=fat)",3)
_ArrayDisplay($result)
|