Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-31 Thread Julien Bonastre
Balazs Hegedus ha scritto: $pattern = '[0-3][0-9]/[0|1][0-9]/[1|2][0-9]{3,3}\s[0-2][0-9]:[0-5][0-9]'; I found this: ^([0-1]?\d)|(2[0-8]))\/((0?\d)|(1[0-2])))|(29\/((0?[1,3-9])|(1[0-2])))|(30\/((0?[1,3-9])|(1[0-2])))|(31\/((0?[13578])|(1[0-2]\/((19\d{2})|([2-9]\d{3}))|(29\/0?2\/((

Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-31 Thread Giacomo
Balazs Hegedus ha scritto: I found this: ^([0-1]?\d)|(2[0-8]))\/((0?\d)|(1[0-2])))|(29\/((0?[1,3-9])|(1[0-2])))|(30\/((0?[1,3-9])|(1[0-2])))|(31\/((0?[13578])|(1[0-2]\/((19\d{2})|([2-9]\d{3}))|(29\/0?2\/[2468][048])|([3579][26]))00)|(((19)|([2-9]\d))(([2468]0)|([02468][48])|([1357

Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Balazs Hegedus
Oops, \s matches any whitespace character, so if you need only space there you should change \s to space (this way it matches tab too). Balazs 2006/3/31, Balazs Hegedus <[EMAIL PROTECTED]>: > Hi, > > this regex isn't perfect at all but might do the job. You should > modify the pattern to match th

Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Balazs Hegedus
Hi, this regex isn't perfect at all but might do the job. You should modify the pattern to match the year part against 2037 as a maximum and also don't forget to checkdate(). Hope it helps, Balazs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/uns

Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Giacomo
Petar Nedyalkov ha scritto: This is not correct since you don't check the ranges of the day digits, month digits, etc. The easiest way to check the string is to explode it by " " (space), then explode the first part by slash and the second by column, and at last check the ranges. A regular exp

Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Petar Nedyalkov
On Thursday 30 March 2006 16:49, Arie Nugraha wrote: > try this : > > $date = "30/12/1982 15:30" > > if (preg_match("/\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}/i",$date )) { > echo "Date is valid"; > } else { > echo "Date NOT valid"; > } This is not correct since you don't check the ranges of the d

Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Arie Nugraha
try this : $date = "30/12/1982 15:30" if (preg_match("/\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}/i",$date )) { echo "Date is valid"; } else { echo "Date NOT valid"; } hope it will help you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-29 Thread Giacomo
Hi everybody, do you have an regular expression example to check a string in a "DD/MM/ hh:mm" format (without seconds)? Bye and thanks, Giacomo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Regular Expression

2004-08-04 Thread Ng Hwee Hwee
thanx a million!! you really saved my day!! :o) hwee - Original Message - From: "John Holmes" <[EMAIL PROTECTED]> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]> Cc: "PHP DB List" <[EMAIL PROTECTED]> Sent: Thursday, August 05, 2004 11:05 AM Subj

Re: [PHP-DB] Regular Expression

2004-08-04 Thread John Holmes
Ng Hwee Hwee wrote: >>(sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2} > thanx!!! it worked like a charm! =) just a question, i've tried adding a ^ to the front of your expressions and a $ to the end of your expression and it still worked.. but is it recommended? why didn't you use them? ^(sin|hkg|bkk|

Re: [PHP-DB] Regular Expression

2004-08-04 Thread Ng Hwee Hwee
al Message - From: "John Holmes" <[EMAIL PROTECTED]> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]> Cc: "PHP DB List" <[EMAIL PROTECTED]> Sent: Thursday, August 05, 2004 10:22 AM Subject: Re: [PHP-DB] Regular Expression > Ng Hwee Hwee wrote: > >

Re: [PHP-DB] Regular Expression

2004-08-04 Thread John Holmes
Ng Hwee Hwee wrote: Hi all, I somehow just couldn't get my regular expression syntax correct. Will you please help me? some examples of my valid string is: sinx0401-001-45 hkgx0403-020-12 jktx0402-000-01 bkkx0407-013-44 the definition is: 1st 4 characters - can only be "sinx" or "hkgx" or "bkkx"

[PHP-DB] Regular Expression

2004-08-04 Thread Ng Hwee Hwee
Hi all, I somehow just couldn't get my regular expression syntax correct. Will you please help me? some examples of my valid string is: sinx0401-001-45 hkgx0403-020-12 jktx0402-000-01 bkkx0407-013-44 the definition is: 1st 4 characters - can only be "sinx" or "hkgx" or "bkkx" or "jktx" next 4

RE: [PHP-DB] regular expression help

2004-06-24 Thread Matt Matijevich
[snip] That does not work either... I can not make the statement fail!!! I have tried $password = "123456"; and $password = "abcdef"; I have change the if statement to what is below and past in all letters and it still works? if (preg_match ('/\d/', $password)) { die ("You must have a numb

RE: [PHP-DB] regular expression help

2004-06-24 Thread Matt Matijevich
you only want to check to see if there is at least one digit? If that is true, this should work: if(preg_match('/\d/',$password)) { echo 'password ok'; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] regular expression help

2004-06-24 Thread Matthias Steinböck
hat there is at least 1 number in the password ? // Larry -Original Message- From: Matthias Steinböck [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 1:41 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] regular expression help hi! is this correct: you want to check if there are

Re: [PHP-DB] regular expression help

2004-06-24 Thread Matthias Steinböck
ok... this still does not do what you want, because it does not consider that only digits should be between the letters... here is the correct solution: // dies $password = 'alfgoesswimming'; // dies too $password = 'a2lf4g2o4e7s9s3w9i0m5m7i0n3g'; // survives $password = 'a2$5l5f4g2o4e7s9s3w9i0

RE: [PHP-DB] regular expression help

2004-06-24 Thread Matthias Steinböck
hi! is this correct: you want to check if there are two letters in the password wich do not surround a digit? if so this is what you need: // dies $password = 'alfgoesswimming'; // dies too $password = 'a2lf4g2o4e7s9s3w9i0m5m7i0n3g'; // survives $password = 'a2l5f4g2o4e7s9s3w9i0m5m7i0n3g'; $foun

RE: [PHP-DB] regular expression help

2004-06-24 Thread Larry Sandwick
die ("You must have a number between 2 letters in your password ... 0-9"); // Larry -Original Message- From: Matt Matijevich [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 12:11 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] regular expression hel

Re: [PHP-DB] regular expression help

2004-06-24 Thread Matt Matijevich
try this $password = 'abcdef'; if (preg_match ('/\w\d\w/', $password)) { die ("You must have a number between 2 letters in your password ... 0-9"); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] regular expression help

2004-06-24 Thread Larry Sandwick
The *if* statement should fail with the password abcdef being qualified but it never fails ? If I understand the expression right, it should have at 1 number in it between 2 letters ? $password = abcdef; if (preg_match ("/[A-z]+[0-9]+[A-z]+/", $password)) { die ("You must have a n

[PHP-DB] Regular Expression

2004-04-18 Thread andy amol
Hi, I would like to test whether a given sting contains only character, it should also support spaces. eg "Course Book String". I am able to test "CourseBookString". Also I would like to know how can we avoid wild chars like *, or any other char apart from alpha numeric char. Thanks.

[PHP-DB] regular expression and exact word search...

2002-11-07 Thread BAROILLER Pierre-Emmanuel
Hi! does someone know how to find an exact word in a content with html tags ? I'm using a regexp like this : $searchRegEx = "'\b".$word_search."\b'msi"; to get boundary word results, but... if the searched word is like 'word or word. or anything else, the regular expression doesn't work.. if I