how to change the color of a line in a HTML page(text in a pre>) Containing A specifique word for example i want to change the color a any line containig "ERROR" and "Erreur"
2014/05/22 02:27:02 - X.0 - Finished processing
2014/05/22 02:27:02 - DSA.0 - Finished processing
2014/05/22 02:27:03 - Block.0 - Finished processing
2014/05/22 02:27:03 - Errors CustomerGroupDimEU.0
2014/05/22 02:27:03 - Old = New ?.0 - Finished processing
2014/05/22 02:27:03 - Exists = 0.0 - Finished processing
this code replace only the word
(function ($) {
var thePage = $("body");
thePage.html(thePage.html().replace(/Error/ig, '<span style="color: red;font-weight: bold;">Error</span>'));
})
The regex was tricky. But here is your desired output :)
(function($) {
var thePage = $("body");
thePage.html(thePage.html().replace(/(^.*\b(Errors)\b.*)$/igm,
'<span style="color: red;font-weight: bold;">$1</span>'));
})(jQuery);
If you want to match more keywords:
/(^.*\b(Errors|Error|Erreur)\b.*)$/igm
You can keep on adding the keywords with |
I have the following User object: { "_id" : ObjectId("someId"), "name" : "Bob", "password" : "fakePassword", "follower" : [...], "following" : [..] } I need to paginate over the follower ...
I have the following User object: { "_id" : ObjectId("someId"), "name" : "Bob", "password" : "fakePassword", "follower" : [...], "following" : [..] } I need to paginate over the follower ...
I am working through a project for a company I plan on working for and I was given a code challenge to create a choropleth map of Kenya. I have been able to generate the map using GeoJSON and TopoJSON ...
I am working through a project for a company I plan on working for and I was given a code challenge to create a choropleth map of Kenya. I have been able to generate the map using GeoJSON and TopoJSON ...
I am trying to show a list grouped by date but the list isn't sorted and I don't know when the date change. It's like I have this Json : list = {name: first, date: 2014-05-21}, { {name: second, date:...
I am trying to show a list grouped by date but the list isn't sorted and I don't know when the date change. It's like I have this Json : list = {name: first, date: 2014-05-21}, { {name: second, date:...
How can i call a javascript function without any event. I have a session variable namely x. what I need is to call a javascript function demo() if the session variable is not null. <% if((String)...
How can i call a javascript function without any event. I have a session variable namely x. what I need is to call a javascript function demo() if the session variable is not null. <% if((String)...