Advertisement
uber

regex example

May 3rd, 2011
680
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.24 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4.  
  5. my $string = "<cartitems>blah blah blah cartitems</cartitems>";
  6.  
  7. if ( $string =~ m/(^<cartitems>)(.*)(<\/cartitems>$)/ ) {
  8.   print "Found: \n 1: $1 \n 2: $2 \n 3: $3 \n";
  9. }
  10. else { print "Found nothing :( \n" }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement