I'm looking for a regular expression that will match everything in this string before 546 so that I can replace it with an empty string and just be left with 546. The string could be of any length and contain any number of hyphens.
I'm looking for a regular expression that will match everything in this string before 546 so that I can replace it with an empty string and just be left with 546. The string could be of any length and contain any number of hyphens.
I wrote a regex to edit a decimal number. you're allowed 1,2, or 3 digits before the decimal point, and 0,1,2,or 3digits after the decimal point. Of course, you can't enter a decimal point without at least a digit after ("5." is invalid). So here is my regex
pattern=/^d{1,3}(.(?=d))d{0,3}$/
This works fine for every case except an integer. In other words, it tests false for entering 5, or 567.
I don't see why it tests false for integers. I'm allowing 1-3 digits before the decimal point, then a decimal point only if the next character is a digit (the lookahead clause), and then 0-3 digits after the decimal point.
I've gotten around this problem with other javascript code around the regex, but I'd just like to know why this "clean" solution doesn't work.
It is validating every thing expect YEAR. It only matches first 2 digits for year instead of 4. I want it to be 4 digits for a year. It returns true if I put 12/25/19.I want it to return false for the above date.
It has to be flexible in that the extension can be either 4, 5, or 6 chars (.php, .html, .shtml for example) and needs to cater for and whether querystring parameters exist too.
--------------------------- Windows Internet Explorer --------------------------- <EMBED src=http://www.youtube.com/v/JTmM3jut05Q&hl=en&fs=1& width=500 height=200 type=application/x-shockwave-flash allowfullscreen="true" allowscriptaccess="always"></EMBED>
how can i get "src" value in above code using regular expression?
does anyone know how I can build a regular expression e.g. for the string.search() function on runtime, depending on the content of variables? Should be something like this:
var strkey = "something"; var str = "Somethin like this";
I need a regular expression that will validate a double quote comma delimited list where the odd entries are numeric and the even are alphabetical. Each pair must also be on a separate line. For example:
"1","Peter" "2","Paul" "3","Mary"
I've used the following expression to validate comma delimited lists, but without the double quotes, numeric/alpha pairing and line return restriction.
Normally I can write regular expressions decently well but for some reason I am having trouble getting this to work. I am validating form data and need to throw an error if there are ANY spaces in the field. abc123 is fine, abc 123 is not. Any character is fine, just not a space.
All I'm trying to do is delete the lines which don't contain a particular string. Actually a filter to edit a log file. I can find and replace a thing with null, but can't figure out how to find the lines which do not contain the thing.
Going further, I want to generalize and use a JavaScript variable containing the decision string, but first I need to worry about the not-within-a-line problem.
Here is the form in question: spraytechDOTcom/download_form.asp I am so close to getting this to work the way that I want, but here is what I am having an issue with: I cannot seem to make it look for the 12 digits that are in the phone numbers that we are going to collect. Ex. 800-123-4567
It doesn't have require 12 characters if there is another way to get the number to validate looking like the example above. Here is my regular expression that I am struggling with:
var re = /[^d-]$/ It seems to block any letters, but it will accept only 1 number. I would really like it to make sure that the phone number is only entered like this: 800-123-4567.
I have looked for days trying to figure this out and have only gotten close.
I'm trying to validate data in a textbox for township (usually written as 12N or 23S for Township 12 North or Township 23 South). In Utah the townships range from 01N to 15N, and 01S to 44S. The expression "/[0-9][0-4][ns]/i" will allow 01n (or s) through 94n (or s). If I change it to "/[0-4][0-4][ns]/i" to limit it to 44n (or s), I then am not allowing for 05, 06, 07, 08, and 09. I hope the above is not too confusing. I'm just starting to work with regular expressions.
This is my first serious attempt at using a regular expression.My first name field should allow alpha characters only [A-Za-z], but it seems to be testing for the presence of 1 alpha character. If one is found in the string then anything else is allowed.Bob returns valid which is what I need.Bob1 returns valid but should NOT be valid..1 returns valid not valid which is what I need.My code.
function isValidFirstName(p1_firstName) { //http://www.javascriptkit.com/jsref/regexp.shtml var re = new RegExp("[A-Za-z]");
I am creating a regular expression for a URL where the domain name (i.e. .com|.edu etc) is optional. That is both http://xyz and http://xyz.com should be valid. If <.> is present then com|edu|.. will be there; but if <.> is absent then com|edu|.. will not be there. Also there can be any number of <.>, but every <.> will be followed by characters. So in other words the string can't end with <.>, it should only end with [a-zA-Z0-9]. So far I have created the following part -
var url=document.myform.addr.value; var str="^(http|https)://(([a-zA-Z0-9.-]+)*[a-zA-Z0-9-]+.(com|edu|gov|[a-zA-Z]{2})|[a-zA-Z0-9]+$)"; var regEx = new RegExp(str);
The mounds of RegExp data will take me days to sift through can someone help me create a regular expression to find a file extension? (all characters after a period) I have already gotten this far: .+. to find everything before and including the period; and I was hoping to integrate the caret to say everything but .+. But I just can't get it to work.
Note: I will be writing a file to the server with JScript ASP. The file name will be passed to the script that writes the file, and I want to make sure that in addition to removing any possible code from the line being written, that I also prevent an executable file from being created. I will be searching for certain extensions and returning if anything else is found.