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;
In reply to Re: Answer: How do I get what is to the left of my match?
by chipmunk
in thread How do I get what is to the left of my match?
by NotProud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |