Help for this page

Select Code to Download


  1. or download this
    $regex = '(\w+)|(\d+)|(\s+)|([^\w\d\s]+)';
    $text = 'The world is foo 2!';
    ...
        print '\s+',$/ if $3;
        print '[^\w\d\s]+',$/ if $4;
    }
    
  2. or download this
    $regex = '(\w+)|(\d+)|(\s+)|([^\w\d\s]+)';
    $text = 'The world is foo 2!';
    ...
        print '\s+',$/ if defined $3;
        print '[^\w\d\s]+',$/ if defined $4;
    }