cdub cdub - 6 months ago 39
Javascript Question

Javascript or JQuery to remove certain text and characters between

I have HTML like so:

For the application these are [a bunch of random characters that need to be removed]).

I need to use Javascript/JQuery (probably a regular expression) to remove the HTML starting with:

For the application these are

and ending with:


Everything in between must go too.

Answer Source

Here's a snippet to remove everything from and including For to ). using regex.

document.body.innerHTML = document.body.innerHTML.replace(/For(.*?)\)\./,'');

For the application these are (sdi12ni3jo45n).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download