in reply to Re: How do I get what is to the left of my match?
in thread How do I get what is to the left of my match?
Keep in mind that /(center)/ will match the first occurence of 'center' in the string, while /(.*)(center)(.*)/ will match the last occurence of center (leaving aside for the moment the issue of newlines).
This might be preferred:On the other hand, sometimes using $` et al. is appropriate./(.*?)(center)(.*)/s;
|
|---|