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.
我想删除此页面上公司名称旁边的所有“(MHC)”实例,以及超过12个其他页面。
like "Northfield Bancorp Inc. (MHC)" to "Northfield Bancorp Inc."
比如“Northfield Bancorp Inc.(MHC)”到“Northfield Bancorp Inc.”
Is there any JavaScript for this? I have tried xslt solution, but still prefer a JavaScript solution.
这有什么JavaScript吗?我尝试过xslt解决方案,但仍然喜欢JavaScript解决方案。
3 个解决方案
#1
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.
此外,您应该在服务器端执行此删除操作。例如,您可以使用PHP在将数据输出给用户之前重新格式化数据。只需使用PHP进行数据库查询,将其存储在PHP变量中,然后适当地解析字符串。
#2
Just do a replace:
做一个替换:
var data = "Northfield Bancorp Inc. (MHC)";
var newData = data.replace(" (MHC)", "", "ig");
#1
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.
此外,您应该在服务器端执行此删除操作。例如,您可以使用PHP在将数据输出给用户之前重新格式化数据。只需使用PHP进行数据库查询,将其存储在PHP变量中,然后适当地解析字符串。
#2
Just do a replace:
做一个替换:
var data = "Northfield Bancorp Inc. (MHC)";
var newData = data.replace(" (MHC)", "", "ig");
#3
You can use javascript regular expressions to parse your text
您可以使用javascript正则表达式来解析文本