Help for this page

Select Code to Download


  1. or download this
    $str = 'This sentence has two numbers, +13 and -15.';
    $str =~ /([+-]?\d+)/;   # matches +13, first match found
    $str =~ /.*([+-]?\d+)/; # matches -15 because .* is greedy