^从行开始处匹配,$从行结束处开始匹配。
\A从字符串开始处匹配,\Z从字符串结束处匹配。
例如:
("this is\nthe time",/^the/) =>this is\n<<the>> time
("this is\nthe time",/is$/) =>this <<is>>\nthe time
("this is\nthe time",/\Athis/) =><<this>> is\nthe time
("this is\nthe time",/\Athe/) =>no match
("this is\nthe time",/time\Z/) =>this is\nthe <<time>>
("this is\nthe time",/time\z/) =>this is\nthe <<time>>
("this is\nthe time",/is\Z/) =>no match
("this is\nthe time",/is\z/) =>no match
\A从字符串开始处匹配,\Z从字符串结束处匹配。
例如:
("this is\nthe time",/^the/) =>this is\n<<the>> time
("this is\nthe time",/is$/) =>this <<is>>\nthe time
("this is\nthe time",/\Athis/) =><<this>> is\nthe time
("this is\nthe time",/\Athe/) =>no match
("this is\nthe time",/time\Z/) =>this is\nthe <<time>>
("this is\nthe time",/time\z/) =>this is\nthe <<time>>
("this is\nthe time",/is\Z/) =>no match
("this is\nthe time",/is\z/) =>no match