I need some help creating some regular expressions that remove specific html tags...the script/expression will run when a button is clicked (i.e. "Remove Bold" button will remove <b> </b>).
currently I have these expressions working but they do not accomplish what exactly what I am after...Actually the functionality I'm looking for will incorperate both, however I can't seem to get it to work properly...
data.replace(/<[^>]+>/ig,"")+""); - this removes all tags (no matter what kind), I would like it to be a little less "greedy" and only remove specific tags.
Input = <u><b>THIS IS SOME DATA</b></u>
Output= THIS IS SOME DATA
data.replace(/<(B|b)[^>]*>[^<]*(</B>|</b>)/ig,"")+""); - this removes bold tags and will leave other tags like <u> behind, exactly what I was looking for. However, it also removes the content/data that is wrapped in the tag.
Input = <u><b>THIS IS SOME DATA</b></u>
In the above example what I would like to happen is:
Input = <b><u>THIS IS SOME DATA</u></b>
Output= <u>THIS IS SOME DATA</u>
I'm trying to write a RegEx function that will remove all HTML tags AND the content in between.
I'm finding a lot of functions that will strip out JUST the tags (leaving the in between content), or will remove tags and content for specific tags only (or will allow only specified tags, removing all else.) But I can't quite seem to write a mask that will take out ALL HTML tags and their content.
Here is the mask I have now (fiftieth version of it, anyway):
Well after much trial and error I come asking for help. I am trying to write a greasemonkey script that scans a page for all the values between certain <td> tags. When I used firebug it shows what I am looking for as <td class="username">THEUSERNAME</td> but when I view the source it just shows up as <td>THEUSERNAME</td> I want to create an array of the 100 <td>'s on the page that pertain to usernames but none of the other <td>'s
I created a test page that mimicked the code, what I thought origionally, to be so I could test my script with ease. And it worked when there was an actually <td class="username">
This is what I have so far:
// ==UserScript== // //Displayable Name of your script // @name EXAMPLE
JS isn't my usual language, but I'm venturing out to write a Chrome extension. This extension basically just injects a script on a page, so it behaves just like any other JS.Anyway, the script finds specific URLs on a specific page, and changes them slightly. I'm using regex to find these URLs. I've got one working, but I need another, and I can't figure it out.The first is this:Also, my skills with regex are miserable, so if you know of any way to make this better, I'm all ears. This matches URLs like this:Now I'm trying to match URLs like this:[URL]If you know how to modify the original regex so that it'll match the second kind of URL (but not the first)
I am working on an asp.net mvc app that loads data via ajax. In the response html there is a script element that contains the client side validation for the data being passed down. I can see the script in the reposnse object, but after I call $(target).html(data); and view the page source the script tag was not inserted. Is there a way to keep jQuery from removing the script tag from ajax data?
The reason why the injections was structured like that is, I want the regular divs to be rounded. the Inject1, Inject2, Inject3 would be style in my external CSS. I think it would also be great if it was like a class that i can just be apply it to specific ids or class.
I would like to strip HTML out of a string I have in a JSON item I have. I'm using Yahoo! Pipes to aggregate several blog-feeds and put them in together in one big feed, I then use jQuery to parse that JSON and place it onto my page. My issue is though that what's being parsed onto my page is the raw html code within the JSON item. I want any HTML related tags out of the item, so I just see text.
I'm trying to remove an html element in the example below. I don't see the "bye" message at the end and there are no errors reported in Firefox or exceptions caught if I wrap the remove child line in a try-catch. Any ideas what is wrong?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>garbage</title> </head> <body>