3 ms·
More specifically, \A and \z are "start of string" and "end of string" respectively. Why not \Z, you ask? \Z will match to the end of the string but ignore a t
by getsat 14y ago
More specifically, \A and \z are "start of string" and "end of string" respectively.
Why not \Z, you ask? \Z will match to the end of the string but ignore a trailing newline.
irb(main):001:0> !!("hello\n" =~ /\Ahello\z/)
=> false
irb(main):002:0> !!("hello\n" =~ /\Ahello\Z/)
=> true