相关疑难解决方法(0)

Anchor\z和\ G如何在Ruby中运行?

我使用的是Ruby1.9.3.我是这个平台的新手.

文档我刚刚得到了两个anchor\z\G.现在我有点玩,\z看它是如何工作的,因为定义(字符串的结束结束)让我感到困惑,我无法理解它的意思 - 通过End.所以我尝试了下面的小片段.但仍然无法抓住.

irb(main):011:0> str = "Hit him on the head me 2\n" + "Hit him on the head wit>
=> "Hit him on the head me 2\nHit him on the head with a 24\n"
irb(main):012:0> str =~ /\d\z/
=> nil

irb(main):013:0> str = "Hit him on the head me 24 2\n" + "Hit him on the head >
=> "Hit …
Run Code Online (Sandbox Code Playgroud)

ruby regex ruby-1.9.3

4
推荐指数
1
解决办法
3994
查看次数

标签 统计

regex ×1

ruby ×1

ruby-1.9.3 ×1