How would I write this to store the text “allofthistextcaptured” with regex? i dont want “_poster” to be captured. The below javascript is exactly what I need, I just need some regex at the end to capture all the text in the src tag EXCEPT “_poster”.
html
<div class="postImage"><img src="allofthistextcaptured_poster.jpg" title="" width="640" height="385" /></div>
js i have so far
var text = $(this).siblings('.postImage').find('img').attr('src');
Will a simple
replace()work for you?If you want to use RegExp then you can do something like this:
Which looks for
_poster.and replaces it with.but this is pretty-much the same thing as the first example.Here’s a demo: http://jsfiddle.net/exAXw/