tags:

views:

66

answers:

3

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

A: 

Like this ?

replace: [/([^./]+)(\.[^\.]+)$/, '/thumb/$1$2'],
Spilarix
this make the '4.jpg' become '4/thumb/.jpg' i want a regular expression to modify the *********.jpg to become /thumb/***********.jpg - - - any help please
Mariam
Edited to take separately filename and extension
Spilarix
A: 

If you have blablablabla.jpg as input, then you do not need regexp for it at all. Simply prefix it with concatenation.

Gábor Lipták
i try [/(\.[^\.]+)$/, '/thumb/'+'$1'], - but the result was convert 4.jpg to 4/thumb/.jpg - -but i need thumb/4.jpg
Mariam
This is why I said completely forget regex. This is such simple: "thumb/" + pictureURL
Gábor Lipták
+1  A: 

Try this:

replace: [/^(.+)$/, '/thumb/$1']
NullUserException
woooooooooooow thx
Mariam