I need to detect and eval the Javascript code contained in a string.
The following code works, but it only evaluates the first <script>...</script> it founds.
function executeJs(html) {
var scriptFragment = "<script(.+?)>(.+?)<\/script>";
match = new RegExp(scriptFragment, "im");
var matches = html.match(match);
if (mat...
I'm using startswith reg exp in javscript
if ((words).match("^" + string))
but if i enter the characters like , ] [ \ /
javascript throwing the exception.
Any idea?
...
Hi All,
I need a help
How to change this regular expression that allows to accept positive numbers
like 0, 0.00, .02,etc.. ,
Now this accept 5 digits decimal that is greater than 0 and up to 100
"^100|(\d\d?)(\.(1[01]?|0\d?))?$"
...
I would like to extract items from this sample html, more specificly, i would like to isolate the following ones:
algp1,
PRODUCTION
50733
GEN_APPL
KANTOOR
<table width="95%" border="1">
<tr><td colspan=3><a name="algp1"></a><img src="menu/db2inst.jpg"> <font color="#FF0000" size="+1">algp1</font> (PRODUCTION, 50733)</td></tr>
<tr><...
I am trying to create a generic formatter/parser combination.
Example scenario:
I have a string for string.Format(), e.g. var format = "{0}-{1}"
I have an array of object (string) for the input, e.g. var arr = new[] { "asdf", "qwer" }
I am formatting the array using the format string, e.g. var res = string.Format(format, arr)
What I...
Does someone have a regex for validating urls (NOT for finding them inside a text passage)? JavaScript snippet would be preferred.
...
Hey,
I have a problem with the regular expression at the bottom. I'm trying to pass all patterns except index.php, robots.txt and any css and js file through the index file, however I have one specific path where I need to process js and css files through php. Normally my url structure is like this:
example.com/class/function
lets say...
Hello,
I have the following regex in PHP:
/(?<=\')[^\'\s][^\']*+(?=\')|(?<=")[^"\s][^"]*+(?=")|[^\'",\s]+/
and I would like to port it to javascript like:
var regex = new RegExp('/(?<=\')[^\'\s][^\']*+(?=\')|(?<=")[^"\s][^"]*+(?=")|[^\'",\s]+/');
var match = regex.exec("hello,my,name,is,'mr jim'")
for( var z in match) alert(match[...
When using string.Format(string, object[]) it throws an exception if string contains more format specifiers ({0}, {1:dd-MM-yyyy} etc.) than object[].Length.
I'd like to also throw an exception if object[].Length contains more specifiers. There seems to be no built-in way to do it, so I'm trying to get the number of format specifiers in ...
I'm confused about the array returned by a regex match when using both /g (to get multiple matches) and parentheses (to get backreferences). It's not clear to me how to get the backreferences because the subscript of the match array seems to refer to the multiple matches, not the back references.
for instance:
string = "@abc @bcd @cde"...
I am trying to come up with a way to match content that does not exist inside any xml or html tags. I've read that using regular expressions is fundamentally bad for parsing xml/html, and I'm open for any solution that will solve my problem, but if a regex works too all the better.
Here's an example of what I'm looking for:
the lazy f...
Hello,
I'm new to regular expressions and would like to use one to search thro...
I'm trying to create a regex that will match only when the string has anything but alphas, spaces, and hyphens. In other words, the string can only contain letters, spaces, and hyphens.
...
In Oracle 10g, I'd like to create a regular expression to list the characters that are
different between two strings.
Here is the reason :
I have a table with a field that contains sometimes Unicode characters that are not in the french language.
I am able to list the rows containing these non standards characters to make a future
c...
So far I have simple "numbers" only ...
/^[0-9]+$/
How can it be done to not allow leading zero (not start with zero) or preg_replace that would remove all spaces and leading zero ?
Thank You
...
I have a very basic regular expression that I just can't figure out why it's not working so the question is two parts. Why does my current version not work and what is the correct expression.
Rules are pretty simple:
Must have minimum 3 characters.
If a % character is the first character must be a minimum of 4 characters.
So the fo...
Where I'm running into a roadblock is trying to check for this
(?<http>(http|ftp|https):\/\/)?(?<address>([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?)
while rejecting the expression if it contains the @ sign.
I've tried a number of variations on this with no success.
What would work is if I can tell it to make sure that there are no @ charact...
I understand how to check for a pattern in string with regexp in ruby. What I am confused about is how to save the pattern found in string as a separate string.
I thought I could say something like:
if string =~ /regexp/
pattern = string.grep(/regexp/)
and then I could be on with my life. However, this isn't working as expected an...
On my site I have a few strings which look something like this (Could be any numbers)
29-30-404-59556348
Using jQuery I want to parse this into
<a href="http://www.mysite.com/page.php?=29,30,404,59556348">Page</a>
How would I do this?
...
I have tried to remove the following tag generated by the AJAX Control toolkit.
The scenario is our GUI team used the AJAX control toolkit to make the GUI but I need to move them to normal ASP .NET view tag using MultiView.
I want to remove all the __designer: attributes
Here is the code
<asp:TextBox ID="a" runat="server" __designer:w...