I was hoping to get a nice push in the right direction I would like to change the ending of my images sources string… i hope i worded that right.
Anyway my current src’s are reading:
<img src="something/something/12345_m.jpg" />
I would like to change it to:
<img src="something/something/12345_t.jpg" />
Any idea guys…Thanks!
This one is a bit safer:
Else you may risk URL’s like
/bat_man/images/oh_my_god_m.pngto end up as/bat_tan/images/oh_my_god_m.pngwhen using eKek0’s answer.Explanation of the regex
/_m(\.[^.]+)?$/:/.../are just pattern borders._mmatches literal_m.(...)match grouping, the first one ends as$1in result.\.matches literal.. Because.is a special char in regex, it’s escaped by\.[...]represents group of characters.^.matches everything but literal.. Because it’s inside a group, escaping is not needed.+matches one or more characters.?previous group is optional (for the case that there’s no file extension).$match must occur at end of string (and thus not in the middle or so).