Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a div:

<div id="crop"><span> text - 123 views</span></div>

I want crop from "-" to "v" ,thanks

share|improve this question

migrated from wordpress.stackexchange.com May 15 '11 at 19:19

This question came from our site for WordPress developers and administrators.

1  
can you explain what you are wanting to do a little better. The term crop is to remove something like crop an image but i do not quite get crop from - to v. Also is the div user created or wordpress plugin core created. –  xLRDxREVENGEx May 13 '11 at 3:47

1 Answer 1

http://jsfiddle.net/8Wqr3/

var $span = $('#crop').find('> span');

$span.text(
    $span.text().replace(/^[\s\S]*-\s+(\d+)\s+[\s\S]*$/m, '$1')
);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.