开发者

Regular Expression Anchors: VBScript.RegExp

开发者 https://www.devze.com 2023-02-19 17:37 出处:网络
What is the difference between $ (End of Line) and \\Z (End of String) with 开发者_StackOverflow社区VBScript.RegExp?

What is the difference between

$ (End of Line)

and

\Z (End of String)

with 开发者_StackOverflow社区VBScript.RegExp?

Is it simply that a String can have embedded CR + LF and $ sets the scope to what precedes CR + LF?

Or does it not matter when using VBScript.RegExp since this object does not accept files as input?

Thanks.


It makes a difference depending on your flags. If Multiline is active (/m), $ matches the end of every line (newlines), but \Z only matches the last position on the string.

A string may contain multiple lines regardless of whether or not if came from a file, for example:
"hello world\nfirefox 4 is out"

See also: Permanent Start of String and End of String Anchors

0

精彩评论

暂无评论...
验证码 换一张
取 消