Answer the question
In order to leave comments, you need to log in
How to strip characters between two specific words using regular expressions?
There are links like :
/catalog/shassi/product/view/28/152.html .
You need to get
:
/catalog/product/view/28/152.html cut everything between the words catalog and product. Can't be implemented with regular expressions using preg_replace
Answer the question
In order to leave comments, you need to log in
$replaced = preg_replace('/catalog(.*)product/', 'catalog/product', $orig);
https://ideone.com/LavYzw
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question