Wednesday, September 17, 2008

[php_mysql] Question to regular expressions Experts.

Hi,
I want to extract date formats (i.e. %d-%m-%y %h:%i %p or %d-%m-%Y or
any other format given in query) from following string . One condition
is that it should pick up the formats which are enclosed only in
DATE_FORMAT() functions not any other.
Can anyone help me for building the regular expression for this.

DATE_FORMAT(A.start_date, '%d-%m-%y') AS STARTDATE,
DATE_FORMAT(B.date_created, '%d-%m-%y %h:%i %p') AS DATESIGNED,
DATE_FORMAT(CONVERT_TZ(B.date_created, 'GMT'), '%d-%m-%y %h:%i %p') AS
DATESIGNED,
DATE_FORMAT(date_add(curdate(),interval 1 day),'%d-%m-%Y')
DATE_FORMAT(DATE_ADD((A.start_date), INTERVAL (A.duration) month), '%d-%
m-%y %h:%i %p') END AS ENDDATE

Thanks in advance.


------------------------------------

The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/php_mysql/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:php_mysql-digest@yahoogroups.com
mailto:php_mysql-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
php_mysql-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

No comments: