Q&A > regular expressions > How do I get what is to the left of my match? contributed by fundflow
$_="left center right";
Keep in mind that /(center)/ will match the
occurence of 'center' in the string, while
/(.*)(center)(.*)/ will match the
occurence of center (leaving aside for the moment the issue of newlines).
Frying pan on the stove
Results (326 votes). Check out past polls.