RegEx Help

What’s the RegEx for this?

<strong>31,412</strong><br>

What are you intending to match?

I need to match the aforementioned text so I can remove it with jQuery. Here’s what I have:

<script type="text/javascript">
$('#stats td:contains(Total Forum Posts)').html($('#stats td:contains(Total Forum Posts)').html().replace(/Total Forum Posts:/gi,''));
</script>

I just need the RegEx to match any number in that thousand, since the match never stays the same as posts increase.


.replace(/\\d*/g, '')

will remove all digits. But, if you expect a comma and/or dot (for decimal) you should use


.replace(/[0-9,.]*/g, '')

But, since you have access to the TD that “contains” this text, can’t you simply replace the entire contents of that cell? That would avoid the complexity (and the necessity) of a RegExp.

Which forum software are you using, in case there’s a built-in way to do the same thing?

$('#stats td:contains(Total Forum Posts)').html($('#stats td:contains(Total Forum Posts)').html().replace(/Total Forum Posts: [0-9,.]*/g, '');

I ran that in Firebug and I get this: http://prntscr.com/6ivs0

I’m not sure how you would replace the entire contents of a cell with jQuery while keeping the statistics still in check.

I’m using ZetaBoards and it does not have the option to remove individual lines from the board statistics.

There’s a mod that removes the board total number of members count - http://resources.zetaboards.com/topic/500148/1/
It’s likely then that there is also a mod that removes the total form posts count too.

Oh look, perhaps this one. Remove post count - http://resources.zetaboards.com/topic/5079033/1/

The first link links to an InvisonFree code. InvisonFree and Zetaboards are on the same network, but they are two different software’s.

The second link links to a code that removes post count in the user details in posts, not the statistics.

This is the first that I’ve heard of or dealt with zetaboard here. I think that you may be better served by posting your query in the forum that is dedicated to zetaboard matters. That way you will have access to people with a great depth of knowledge in zetaboard matters.

I suspect that an appropriate zetaboards forum is at Zathyus Networks Resources > Requests Corner > Codes & Modifications