develooper Front page | perl.perl6.users | Postings from June 2020

Code assertions to spy on regexps behavior

Thread Next
From:
Joseph Brenner
Date:
June 15, 2020 00:55
Subject:
Code assertions to spy on regexps behavior
Message ID:
CAFfgvXUy=GDQopTO5FhrY2+ax9w-Z6Pq5boJSKv7dZyyO567+g@mail.gmail.com
By the way, I've been finding code assertions are a fun way of
spying on what's going on with your regexps:

  $_ = "Alpha beta gamma";
  my @matches = m:g/(a) <?{ put $0.pos }>/;
  # 5
  # 10
  # 13
  # 16

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About