HN2new | past | comments | ask | show | jobs | submitlogin

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


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: