Regular Expression :: Validate Date-time Field In European D/m/y H:m:s Format

Jul 23, 2005

I have the following regular expression to validate a date-time field
in European or d/m/y h:m:s format.

^((((31/(0?[13578]|1[02]))|((29|30)/(0?[1,3-9]|1[0-2])))/(1[6-9]|[2-9]d)?d{2})|(29/0?2/(((1[6-9]|[2-9]d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))|(0?[1-9]|1d|2[0-8])/((0?[1-9])|(1[0-2]))/((1[6-9]|[2-9]d)?d{2}))
(20|21|22|23|[0-1]?d):[0-5]?d:[0-5]?d$

I wish to ammend it so that the time or h:m:s part is validated only if
supplied (i.e. I wish to make the time part optional). At present if a
time is not supplied the validation fails. I gather that the following
part of the above expression

(20|21|22|23|[0-1]?d):[0-5]?d:[0-5]?d$

validates the time, however I don't know the syntax to make it
optional.

View 6 Replies


ADVERTISEMENT

Time Format Regular Expression

Sep 28, 2004

I have the function below to check the user input for time format. I need to modify the reg expression to NOT allow this format (hh:mmAM/PM). I want to force the user to add a space between the (mm) and (AM/PM)(hh:mm AM/PM) instead of (hh:mmAM/PM).

function checkAccessTime(time)
{
if (time.value != '')
{
if (!/^(1[0-2]|0?[1-9]):[0-5]d ?[ap]m$/i.test(time.value))
{
alert('Enter a valid time format hh:mm AM/PM');
time.focus();
time.select();
return false;
}
return true;
}
else return true;
}

View 2 Replies View Related

Date Format For MySql - Date To Be Saved European Not American

May 26, 2011

We have a little callendar on our website. I have set the format of the date to "dd-mm-y" because I want the date to be saved europian, not american. When comfirming the form, the date is saved as 0000-00-00. The date shows correctly on the form itself. I have two scripts: Calendar.js and Calendar-en-GB.js. Calendar-en-GB.js contains the 'settings'. (Including date format). I can't figure out the problem and thought maybe one of you could. I have uploaded the scripts in one .zip file: [URL]

View 3 Replies View Related

Regular Expression For A Date?

Aug 26, 2010

I have this expression:

/(19|20)dd/)[- /.](0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])

to detect if my date:

2010-12-15

is valid. It's not working. What do I have wrong?

View 6 Replies View Related

Regular Expression To Validate Township

Mar 31, 2009

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.

View 2 Replies View Related

Regular Expression Validate Email Address

Jul 23, 2005

/^[a-zA-Z0-9_-]+([.][a-zA-Z0-9_-]+)*@[a-zA-Z_-]+([.][a-zA-Z0-9_-]+)*$/

I'm using this to try to validate a small subset of the valid e-mail
addresses allowed by the relevant RFC (alphanumerics, underscores, and
dashes). I've tested it and it seems to work....

View 6 Replies View Related

JQuery :: Validate Custom Regular Expression?

Aug 5, 2010

Does anyone know if it is possible to use your own regular expression for fields with the JQuery Validation plugin?I have previously used Live Validation (standalone) which allows you to do this kind of thing:var loginpass = new LiveValidation('loginpass');loginpass.add( Validate.Format, { pattern: /^[A-Za-zd]+$/i } );

View 5 Replies View Related

Regular Expression - Validate String With Alphanumeric

Oct 14, 2009

How can i validate string with alphanumeric, space, dash and dot in regular expression ?

View 1 Replies View Related

Regular Expression :: Validate US And Canadian Postal Codes?

Oct 20, 2005

Does anyone know of a regualr expression to validate US and Canadian Postal
Codes? I want to be able to accept ##### or #####-#### or Canadian A#A #A# that is
alpha,number,alpha number,alpha,number.

I am new to regular expressions. The US 5 digit part is easy, but I get
stuck after that.

var pattern = new RegExp(/d{5}/)

View 4 Replies View Related

Australian Zip/postal Codes -- Regular Expression To Validate

Jul 27, 2005

I need help to validate Australian zip/postal codes? Also need to know the format of the codes -- like Canadian postal codes are

Alpha Numeric Alpha Numeric Alpha Numeric

View 3 Replies View Related

Regular Expression :: Validate Numbers Separated By Period (.)

Dec 19, 2005

I need a regular expression to validate a string which consists of numbers, seprated by a period. For example: 123.456.7890.123 or

543245634.564362454.543543523.43532543

Basically, its a set of any amount of numbers, seperated by a period, ocurring any number of times. Now this is my first time dealving into regular expressions, and after reading some tutorials i came up with this:

/+((+d).)/

Would this evaluate correctly?

View 3 Replies View Related

Regular Expression To Test The Validity Of An Input Date?

Jan 6, 2011

I have the following regular expression to test the validity of an input date:

([0-9][0-9]|[0-9])[s/-]([0-9][0-9]|[0-9])[s/-]([0-9][0-9][0-9][0-9]|[0-9][0-9])

It should allow 1 or two digits for the day of the month, then a separating character (" ", "/" or "-"), then 1 or two digits for the month, then 2 or 4 digits for the year.

Unfortunately it will accept anything above 2 digits for the year, which I understand why is happening but don't know how to fix!

View 4 Replies View Related

Regular Expression - Validate That An Email Address Cannot Contain Any White Space Character?

May 22, 2009

i am using the following regular expression for the validation of Email address /^.+@([?)[a-zA-Z0-9-.]+.([a-zA-Z]{2,3}|[0-9]{1,3})(]?)$/; but the problem is that if user enters any white space character while entering email address then email is considered as valid how ever we know that an email address can not contain any white space character i have tried a lot but could not get a correct regular expression

View 2 Replies View Related

Regular Expression For A Usernmae Field?

Jul 21, 2011

Without getting too bogged down in regexe's. I'm after a Javascript expression that validates a username field. The field must validate to allow a user to:Must be between 6 and 20 characters long, with at least one lowercase letter, one uppercase letter, and one number.that is, in any combination in any order. Ive got:

Code:
/^(A-Z)+(a-z)+(0-9){6,20}$/

but this matches (If i've got this right) Uppercase first followed by lowercase then a
number - 'too restrictive'.

View 4 Replies View Related

Regular Expression :: For Variable Contents Of A Field

Aug 22, 2005

I need to build a regular expression where the expression contents are
variable.

for example I have a string that i need to search for, but the string can
change. If i have a variable called string I need to look at the contents of
string otherwise

/string/

obviously doesn't work!

View 1 Replies View Related

Regular Expression - Input In Format "A-xxxx-xxx" Where 'x' Is Any Alphanumeric Character

Mar 28, 2009

I want input in format "A-xxxx-xxx". where 'x' is any alphanumeric character.

View 1 Replies View Related

Validate A Date By Using Regular Expressions?

Oct 4, 2011

I am trying to validate a date by using regular expressions.I have parts working, such as only accepts numbers, but I cannot get the range correct. On the "mm" field, I am getting errors.

if(form.mm.value=="")
{
alert("Please insert your birth month");
return false;}

[code]....

View 1 Replies View Related

Regular Expression :: Check A Text Field Value To Accept Between 0-20

Aug 6, 2005

i'm fairly new to regular expression and want to know if it's possible to check a text field value. I need to only accept value between 0 and 20. I've got also a problem with the 0 value ... guess the script think it's false :

if(!Number(document.data.f_cat_1.value) || document.data.f_cat_1.value > 20){
alert('Your must enter a numeric value between 0 & 20 pts!');
document.data.f_cat_1.focus();
return false;
}

View 1 Replies View Related

Check Against Any Input Text Field Using Regular Expression?

Nov 22, 2011

i studied what is RegEx and i wan't to implement it. problem is i don't know how to use it or check it aganist any input text field etc.

View 2 Replies View Related

Date Time Format

Dec 19, 2006

how to display day of the week and month in word not number

day of the week: Mon or Tue etc..
month: Nov, Dec

View 7 Replies View Related

Changing The Date And Time Format?

Mar 18, 2011

I would like to learn if there is way to change a different format every time the user want as example is London 12:00:33 - Friday 18/03/2011

View 2 Replies View Related

JQuery :: Validate An Input Date In Custom Format?

Aug 1, 2010

Im new to jquery so bare over with me :) I have a form, and when the user clicks the submit button, I want jquery to first validate a date field for its format. The format has to be like this: dd-mm-yyyy. So a date of 30-30-3000 would also be valid.

View 4 Replies View Related

Get/format Date Field

Jul 23, 2005

I have an asp page that uses a calendar.js (pop-up) file to add an
exact date format in the text field (txtDDate). My problem is I need
some javascript that sets an alert that does not allow them to select
today.

example:
var dtToday = Date()
if(document.frmSoftware.txtDDate.value == dtToday)
{
alert("You cannot select same day distributions. Please enter a new
value in the "Delivery Date" field.");
return false
}

But dtToday is blank....How can I get dtToday value? Also, when I set
the dtToday value outside javascript and used a Response.Write to see
what format Date() came up with - it gave me 1/24/2005 - but the
calendar pop-up gives me 01/24/2005....could this also be the issue?

View 4 Replies View Related

Regular Expression :: Validate Numbers Separated By "-"

Oct 17, 2007

I need a regular expression that validate a list of numbers separated by "-" , numbers can not be greater than 999

Valid examples:

0
12-455-01
1-9
125-32-155-45-45

Invalid examples
-1
45-
1-45665456-4
12-45-
-

View 2 Replies View Related

Click On Button To Add Time To A Form Field In A Certain Format?

May 25, 2011

i am looking for a way to click on a button next to a time field that will paste the current date and time into that filed in this format: 01:00:00 08-08-2007 is that possible?

View 3 Replies View Related

JQuery :: Changing Datepicker's Date Format Of Selected Date From Date Picker

Mar 16, 2011

I am having difficulty trying to change the format of selected date from date picker. This is a test so my code is very simple. Here it is.

[Code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved