Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression problem

Status
Not open for further replies.

jerijeri

Programmer
Sep 11, 2002
33
CA
I have a csv file that has multiple dates in it.
they are in the format 1/17/2003

I want to convert to 2003-01-17

I've tried the following expressions:

match {.*}\/{.*}\/{.\d.\d.\d.\d},

replace with

\3-\2-\1, (this doesn't handle converting 1 to 01) but that's not the biggest problem.

What's happening is that {.*}\/{.*}\/{.\d.\d.\d.\d},

matches everything between 2 dates. I'm trying to specify that it must only match 4 digits followed by a comma. I can't find examples for that.

Thanks,

Jer
 
Found solution.

used {\d*}\/{\d*}\/{\d\d\d\d} to match the date.

That solved the problem.

Jer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top