Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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


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

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

Your Answer


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.