I need to write some javascript to strip the hostname:port part from a url, meaning I want to extract the path part only.
i.e. I want to write a function getPath(url) such ... |
I'm really sorry if this has been answered before but I just can't seem to find the proper answer. I have a string in JS and it includes an href tag. ... |
How can I remove all characters from a string that are not letters using a JavaScript RegEx?
|
I am trying to make a regex that will just look for and remove script tags(its the only tag I wanted removed since I think it is the only one that ... |
Thanks in advance.
I would like a regular expression that removes anything that is NOT alpha numeric and a hyphen. So allowed are A-Z 0-9 and -.
Also, how could I apply that ... |
I am trying to remove all the html tags out of a string in Javascript.
Heres what I have... I can't figure out why its not working....any know what I am doing ... |
I'm trying to do remove javascript comments via regex in C# and have become stuck. I want to remove any occurrences of double slash // style comments.
My current regex is ... |
|
how do i remove the last line from a block of text in java script without using loops.(only using regex)
eg.,
"The Internet is a global system of interconnected computer networks that use ... |
I may have URLs like:
and what I would like to do is to remove part before /foo/bar/, with regex which will work if I have ... |
I have this regex. My problem is the two second lines of the code:
<%
content = ""+Request.Form("completehtml")+"";
contentmatch = content;
contentmatch = content.match(/<div class="content">[\s\S]+?#-#/ig);
htstring1 = contentmatch;
htstring2 = htstring1.replace(/#-#/ig, '');
%>
I want to ... |
I am trying to write a regexp that removes file paths from links and images.
href="path/path/file" to href="file"
href="/file" to href="file"
src="/path/file" to src="file"
and so on...
I thought that I had it working, but it ... |
Regex to remove everything outside the { }
for example:
before:
|loader|1|2|3|4|5|6|7|8|9|{"data" : "some data" }
after:
{"data" : "some data" }
with @Marcelo's regex this works but not if there are others {} inside ... |
Been hit with some nasty javascript malware on my site. I know that each offending code block starts with the following:
<script language=javascript><!--
(function()
and ends with
</script>
I'd like to ... |
Suppose I have (in a javascript regular expression)
((((A)B)C)D)
Of course that really reads
ABCD
Is there an algorithm to eliminate unnecessary parentheses in a string like that?
|
I'm working on a large and extremely messy javascript file, and I would like to remove all functions from the file, ultimately creating a version which contains only data.
the code looks ... |
I want to delete empty tags such as <label></label>, <font> </font> so that:
<label></label><form></form>
<p>This is <span style="color: red;">red</span>
<i>italic</i>
</p>
will be cleaned as:
<p>This is <span style="color: red;">red</span>
<i>italic</i>
</p>
I have this RegEx in javascript, ... |
For some reason, I can't seem to find a good answer for this one.
I have been trying to escape out the caret (\^), and to use the hex, octal, and other ... |
I am using below regular expression to remove comments from string
<\!{1}\-{2}(.*?)\-{2}\s*>
This is working fine except for mult-iline string
var search = '<\!{1}\-{2}(.*?)\-{2}\s*>';
var re = new RegExp(search, "gm");
var ...
|
I am hoping that someone can help me. I am not exactly sure how to use the following regex. I am using classic ASP with Javascript
completehtml = completehtml.replace(/\<\!-- start-code-remove --\>.*?\<\!-- start-code-end ...
|
I have these strings:
/banking/bonifici/italia
/banking/bonifici/italia/
and I would like to remove - with javascript - first slash and last slash if it's exists.
I tried ^\/(.+)\/?$ but it doesn't work.
Reading some post in stackoverflow ... |
I am having trouble getting a regex to work. This is the string.
"some text would be here and Blah St:39.74908:-104.99482:272~Turn right over here"
I need to remove the
:39.74908:-104.99482:272~
part of the ... |
Need to search a string and replace value="ANYTHING" with value="", basically blank out the value. Thanks.
|
I have the following regexp (/\?(.*?)\&/) which when I use it in the following javascript code it removes the "?" from the replacement result.
href=href.replace((/\?(.*?)\&/),"")
The beginning href value is this...
/ShoppingCart.asp?ProductCode=238HOSE&CouponCode=test
I get this ... |
I have a string that i would like to remove all occurrences of <br>
I tried this and it did not work.
productName = productName.replace("<br>"," ");
However this worked but ... |
I have a string which could contain several different values, among them are.
EDITED for clarity:
var test could equal FW21002-185 or FW21002-181-0001 or abcdefg or 245-453-654 or FW21002-181-00012
I would like ... |
I'm building a string of amounts but need to remove the dollar signs. I have this jQuery code:
buildList($('.productPriceID > .productitemcell'), 'pricelist')
It's returning
pricelist=$15.00,$19.50,$29.50
I need to remove the dollar signs but ... |
I would like one RegExp that will remove all special characters from a string. I am trying something like this but it doesn't work in IE7 (which is what the works ... |
Input:
Dynamic Text (PDF 120 KB)
Output:
Dynamic Text
|
I have a string like so
item[3]>something>another>more[1]>here
hey>this>is>something>new
.
.
.
I would like to produce the following for each iteration indicated by each new line
item[3]>something>another>more[1]>here
something>another>more[1]>here
another>more[1]>here
more[1]>here
here
Another example:
hey>this>is>something>new
this>is>something>new
is>something>new
something>new
new
I would like a regex or some way to incrementally remove ... |
I have a couple strings like:
net_weight_(lbs)
net_height_(inches)
I need a regular expression that will remove the _(x) from the end of the string. So in my two examples, I would be left ... |
I have a url in this format:
http:\/\/example.example.ru\/u82651140\/audio\/song.mp3
How can I remove the extra "\"s from the string? I have tried string.replace("\","") but that does not seem to do anything. If you could ... |
I've got some ugly HTML generated from Word, from which I want to strip all HTML comments.
The HTML looks like this
<!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:RelyOnVML/> <o:AllowPNG/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte ...
|
I having the following code. I want to extract the last text (hello64) from it.
<span class="qnNum" id="qn">4</span><span>.</span> hello64 ?*
I used the code below but it removes all the integers
questionText = questionText.replace(/<span\b.*?>/ig, ...
|
I stumbled across this article which was talking about AJAX and jQuery and I reached this line
hash = hash.replace(/^.*#/, '');
where hash is in the form #page1,#page2 etc...
Now what I ... |
Any way to easily remove all HTML from text but keep all links? I know how to strip all HTML tags, but can't figure out how to keep just links...
Here's my ... |
Can anyone help me with the following regex
<script type="text/javascript">
function quoteWords() {
var ...
|
I have a javascript string contains html table like this:
<div class="nobrtable"><table class="at"><TBODY><TR><td> FY
</TD><td> Profit Margin
</TD><td> Asset Turnover
</TD><td> RoA
</TD><td> Leverage ...
|
I am just trying to remove bullets from the text. For example when i am copying bulleted text list from MS Word to any textbox it is showing along with bullet. ... |
I am copyig some data from the MS Word. That text may contain or May not contain Bullets in the copied text. But i need a Regular expression in javascript to ... |
|
I'm trying to remove all type casts from a js file.
The current (not-working) regex I have is:
/(?!new\s+&?!function\s+)\w+\((.+)\)/gi
Basically I want anything like Class(var) but not new Class(arg) or function Func(arg)
Thanks!
|
i'm trying to remove all my console.log, console.dir etc from my js file before minifying it with yui (on osx).
the regex i got for the console statements looks like this:
console.(log|debug|info|warn|error|assert|dir|dirxml|trace|group|groupEnd|time|timeEnd|profile|profileEnd|count)\((.*)\);?
and it ... |
i want to strip script tags out of this html at pastebin
http://pastebin.com/mdxygM0a
I tried using the below regular expression
html.replace(/<script.*>.*<\/script>/ims, " ")
But it does not remove all ... |
|