回复 988# 131738
看看测试结果: (特意还在前面及后面都增加了空行、空格行做测试,同样剔除)### 友情提示:本脚本由 Au3.REHelper 于 2011/11/29 21:48 自动生成,不保证其正确性,请自行测试 ###
Local $Str = _
@CRLF & _
' ' & @CRLF & _
'###Function###' & @CRLF & _
'Abs' & @CRLF & _
' ' & @CRLF & _
'###Description###' & @CRLF & _
'Calculates the absolute value of a number.' & @CRLF & @CRLF & _
'###Syntax###' & @CRLF & _
'Abs ( expression )' & @CRLF & @CRLF & @CRLF & _
'###Parameters###' & @CRLF & _
'@@ParamTable@@' & @CRLF & _
'expression' & @CRLF & _
' Any valid numeric expression.' & @CRLF & _
'@@End@@' & @CRLF & @CRLF & _
'###ReturnValue###' & @CRLF & _
'Returns absolute value of <i>expression</i>.' & @CRLF & @CRLF & @CRLF & _
'###Remarks###' & @CRLF & _
'A string has a value of zero.' & @CRLF & @CRLF & _
'###Related###' & @CRLF & _
'None.' & @CRLF & @CRLF & @CRLF & _
'###Example###' & @CRLF & _
'@@IncludeExample@@' & @CRLF & _
' ' & @CRLF & @CRLF & _
' ' & @CRLF
MsgBox(0, '原字符串', $Str)
Local $Test = StringRegExpReplace($str, '<[^>]+>|^\s*\v|\r\n\h*(?=\r\n)|\v+\s*$', '')
MsgBox(0, '替换结果', $Test)
|