This won't do anything at all. For starters, you need to use =~ for matching and substitutions. The star (*) is a quantifier, and won't do anything unless you put it after something. In fact, it will give you an error the way you have it now, since it doesn't follow anything. Maybe something like this will be improved:$string = m/($start)(*)($end)/;
As an aside, you probably want to start getting used to use strict (although not absolutely necessary in such a small script you have here). Also, CGI::Carp qw/fatalsToBrowser/ will send fatal messages to the browser, making it easier to debug.$string =~ /$start(.*?)$end/s;
Update: match newlines and no case sensitivity. Thanks Juerd and cLive ;) I figured I would miss something! :)
Update: as Yves pointed out, (.*?) would be the best way to go! Thanks, Yves.
- Derek Soviak
In reply to Re: pattern matching
by dereks
in thread pattern matching
by silent11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |