Help for this page

Select Code to Download


  1. or download this
    my %good = map +($_ => 1), qw{ pre strong };
    my $string = "xxx<pre>xxx<www>xxx<strong>xxx";
    while ($string =~ m{<(\w+)>}g) {
      warn "bad word '$1'" unless $good{$1};
    }
    
  2. or download this
    print "ok\n" if $string =~ m{
      ^ (
        [^<]
      | < (?: pre | strong ) >
      )* $
    }x;