please help me with this regular expression
i use开发者_如何学编程 a slideshow jquery plugin which automatically create a thumbnails path from my original image path as follows
replace: [/(\.[^\.]+)$/, 't$1'],
whenever i have a blablablabla.jpg
it knows that the thumb path is the same path with t suffix blablablablat.jpg
but i want to change this to /thumb/blablablabla.jpg
how can i achieve this using regular expression as the example above
Try this:
replace: [/^(.+)$/, '/thumb/$1']
If you have blablablabla.jpg as input, then you do not need regexp for it at all. Simply prefix it with concatenation.
Like this ?
replace: [/([^./]+)(\.[^\.]+)$/, '/thumb/$1$2'],
精彩评论