Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

How will my regular expression match?

by hv (Parson)
on Jul 04, 2004 at 16:57 UTC ( #371722=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
      ($match) = "The longest word" =~ /(\w+)/;
      print $match;
  2. or download this
      ($match) = "Mrs Smith" =~ /(Mr|Mrs)/;
      print $match;
  3. or download this
      ($match) = "/foo/bar" =~ m[.*/(.*)];
      print $match;
  4. or download this
      ($match) = "foo/bar/baz" =~ m[.*?/(.*)];
      print $match;
  5. or download this
      ($outer, $inner) = "/foo/bar" =~ m[(/(.+))*];
      print $inner;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://371722]
[GotToBTru]: i like to order my chemicals a-la-carte ambrus ;)
[thepkd]: Hi, in trying to create an Array of Hash of Array of Hash. You read it right. Is it possible to dereference it without using temps?
[GotToBTru]: what are temps?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2016-12-06 13:12 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.