What is this user-input regex checking for? /^[^<">]*$/
This regex is used to check some user input: /^[^<">]*$/ What is it checking for? ...
This regex is used to check some user input: /^[^<">]*$/ What is it checking for? ...
I need to find all the strings in a set of c# files, unless they are inside a Contract.Require statement. There could be any amount of text in the string, so between the " and ", and any amount of text between the string and the Contract.Require. I have this: /".+"/ which finds strings, but I need to refine my search. Is this even p...
Is it possible to do: @foo = getPileOfStrings(); if($text =~ /@foo(*.?)@foo/) { print "Sweet, you grabbed a $1! It lived between the foos!"; } What's going on here is I need a $text =~ /($var1|$var2|$var3)(*.?)($var1.../; I don't know how many values there are, and I don't know the values until run-time. Array interpolation into a ...
Hi all! I am seeking for a regular expression pattern that could match urls in HTML that aren't wrapped into 'a' tag, in order to wrap them into 'a' tag further (i.e. highlight all non-highlighted links). Input is simple HTML with 'a', 'b', 'i', 'br', 'p' 'img' tags allowed. All other HTML tags shouldn't appear in the input, but tags m...
I have some code that grabs the "between" of some text; specifically, between a foo $someword and the next foo $someword. However, what happens is it gets stuck at the first "between" and somehow the internal string position doesn't get incremented. The input data is a text file with newlines here and there: they are rather irrelevant,...
I'm trying to replace something multi line in Javascript, IE is giving me trouble. pastebin here:http://jsbin.com/olahi/edit Explanation of what I'm trying to do: Here's my HTML: <textarea id="editthis"> Hello from JS Bin Whats up from JS Bin Whats up from JS Bin </textarea > And my JS: jQuery.fn.runReplacement= function(expr) { ...
Hi there, Not sure if this is possible with a regular expression replace command, but I have an existing regex replace which will convert the last two digits of a number to the same last two digits prefixed with a full stop. This is for interfacing to a system which sends through currency values as "2500" where this represents "25.00" ...
In JavaScript I have a string containing a DOM fragment. How would I find and replace the src attribute of an image? I would like to replace the path of all images with a new path but keeping the image name. Not all the paths are the same and can come from various locations. My regular expression skills are poor at best. For example: ...
I want to add a href links to all words prefixed with # or ! or @ If this is the text Check the #bamboo and contact @Fred re #bamboo #garden should be converted to: Check the <a href="/what/bamboo">#bamboo</a> and contact <a href="/who/fred">@Fred</a> re <a href="/what/bamboo">#bamboo</a> <a href="/what/garden">#garden</a> Note that...
Say i have a string like this: "23423423" and i want to find all numbers with length of 2 with regex like this "[0-9]{2}" Now in my texteditor this gives me 7 matches: 23, 34, 42, 23, 34, 42, 23 however in c# i seem to be only getting 4 23, 42, 34, 42 I need the first scenario but cannot find a solution. I have tried regex.Match() ...
Assume the following strings: A01B100 A01.B100 A01 A01............................B100 ( whatever between A and B ) The thing is, the numbers should be \d+, and in all of the strings A will always be present, while B may not. A will always be followed by one or more digits, and so will B, if present. What regex could I use to capture...
Value will be anything and matches is null. The point of this is to split up a string like "1991-12-01" and make sure that all of the parts of the string are valid dates. dateISO: function(value, element) { if (this.optional(element)) return true; var regexp = new RegExp('^\d{4}[\/-](\d{1,2})[\/-](\d{1,2})$'); var matches = ...
Ok, so I'm doing a mod_rewrite, and I'm in a situation to where I need to match any subdomain except for one. It starts out looking like this. RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$ [NC] So that matches and captures a single subdomain, no periods. But let's say I don't want to match the submdomain named 'dog'. I tried to do...
A certain variable might contain a relative path or an absolute path. Either way, I need to be able to pull the filename from the variable: http://www.somesite.com/dir1/dir2/filename.gif /dir1/dir2/filename.gif The directory structure is also arbitrary. So basically given either of the url's above (with arbirtrary directory structur...
I'm trying to redirect URLs from example.net/customname or example.net/customname/ to example.net/my/home.php?username=customname . This in itself is not complicated: RewriteRule ^([a-zA-Z0-9_-]+)$ my/home.php?username=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ my/home.php?username=$1 However, I want to exclude my existing directories and fi...
I apologize for the very specific issue I'm posting here but I hope it will help others that may also run across this issue. I have a string that is being formatted to the following: [[,action1,,],[action2],[]] I would like to translate this to valid YAML so that it can be parsed which would look like this: [['','acton1','',''],['ac...
I am using Jquery Validation. Currently, I have a username, what i want to validate for this username is: Not blank Availability No whitespaces, I add this method: $.validator.addMethod("nowhitespace", function(value, element) { return this.optional(element) || /^\S+$/i.test(value); }, " No white space please"); Alphanumeric ...
I've generated a feed from GameTraillers.com for my favorite show there — ScrewAttack. But the embed option doesn't show up on Google Reader because the embedded video is in another castle tag: item.exInfo:fileType.embedcode. I've managed to find the tag where the embed code is, removed the "<![CDATA[" and "]]$gt;" from that tag with Re...
The fragment below doesn't work for me. fragment = Regex.Replace(fragment, "<!--.*?-->", String.Empty , RegexOptions.Multiline ); ...
I have a big HTML file that has lots of markup that looks like this: <p class="MsoNormal" style="margin: 0in 0in 0pt;"> <span style="font-size: small; font-family: Times New Roman;">stuff here</span> </p> I'm trying to do a Vim search-and-replace to get rid of all class="" and style="" but I'm having trouble making the match ungreed...