regex - Find Two Words on url string -


i'm trying find 2 words on urls, looks underscore don't allow word found

http://www.example.com/image/med_crop/photo.jpg

http://www.example.com/image/medium/photo.jpg

/\bmedium\b|\wmed_crop\w/i 

http://regex101.com/r/wi5of7/1

why use \w around "med_crop". \w matches [a-za-z0-9_], not slashes. also, need use global modifier g if want match more 1 @ time.

this seems work in example

/\bmedium\b|\bmed_crop\b/ig 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -