今天学习VBscrpt下的正则表达式时,有段代码执行老是提示语句为结束,请过请教他人,发现原来是我把多个语句写到一行造成的。
多个语句本身是可以的,但有个规则,即需要在语句之间加":",如For Each objMatch In colMatches:sMsg = sMsg & "Blank line found at position" & objMatch.FirstIndex & "of the string.":Next。但是为了便于代码阅读,一般不这样写。
另外,有些语句比较长时,需要多行,此时需要"_"来连接,如:sMsg = sMsg & "Blank line found at position" & _
objMatch.FirstIndex & "of the string."
这些都是很基础的东西,但越是细微的东西,越容易被忽略,所以记录下来,以免忘记