正则表达式中\A,\z和^的区别
答案:1 悬赏:0 手机版
解决时间 2021-04-01 23:17
- 提问者网友:原来太熟悉了会陌生
- 2021-04-01 19:43
正则表达式中\A,\z和^的区别
最佳答案
- 五星知识达人网友:几近狂妄
- 2021-04-01 20:52
^从行开始处匹配,$从行结束处开始匹配。
\A从字符串开始处匹配,\Z从字符串结束处匹配。
例如:
("this is\nthe time",/^the/)
=>this is\n<> time
("this is\nthe time",/is$/)
=>this <>\nthe time
("this is\nthe time",/\Athis/)
=><> is\nthe time
("this is\nthe time",/\Athe/)
=>no match
("this is\nthe time",/time\Z/)
=>this is\nthe <
\A从字符串开始处匹配,\Z从字符串结束处匹配。
例如:
("this is\nthe time",/^the/)
=>this is\n<
("this is\nthe time",/is$/)
=>this <
("this is\nthe time",/\Athis/)
=><
("this is\nthe time",/\Athe/)
=>no match
("this is\nthe time",/time\Z/)
=>this is\nthe <
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯