views:

171

answers:

3

There is large website all data comes from database ,

I want to remove all instances of "(MHC)" from next to company name on this page, and also more than 12 other pages.

like "Northfield Bancorp Inc. (MHC)" to "Northfield Bancorp Inc."

Is there any javacript for this, I have tried xslt solution, but still prefers Javascript solution.

+6  A: 

First of all, I'd just change the database entry...

Furthermore, you should be doing this removal on the server side. For example, you can use PHP to reformat the data before outputting it to the user. Simply use PHP to make the database query, store it in a PHP variable, and then parse the string appropriately.

AlbertoPL
Combine this answer with David Dorward's comment on the question and you have a perfect explanation.
T Pops
A: 

Just do a replace:

var data = "Northfield Bancorp Inc. (MHC)";
var newData  = data.replace(" (MHC)", "", "ig");
Bryan Migliorisi
You're right, but there doesn't exist a third parameter in replace. You'll need to convert it to a regular expression to make it work as excepted: / \(MHC\)/ig In this case, though, a global case-insensitive search is a bit of an overkill, since it works perfectly OK without it.
moff
Well, 3rd parameter exists in some browsers.
Bryan Migliorisi
A: 

You can use javascript regular expressions to parse your text

Eric