Matching content between two point php regex -


i'm trying create regex replace

href="/test/any-word-here" 

with

href="/search/theword.html" 

i'm pretty new regex's i'm not sure i'm doing came this

preg_replace('[href="/test/]([a-za-z])\"', "href=\"/search/$2.html\"", $content); 

could me out?

you close. [] undesirable. need capture entire word , not 1 letter.

preg_replace('#href="/test/(\w+)"#', 'href="/search/\1.html"', $content); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -