View Single Post
 
Old 01-28-2016, 09:46 AM
Marrick13 Marrick13 is offline Windows XP Office 2010 32bit
Competent Performer
 
Join Date: Jun 2006
Posts: 102
Marrick13 will become famous soon enough
Default Regex/wildcard search for dates with 2-digit and 4-digit years

I have been working with the attached code to see if I can get it to search and format dates in Word. I am trying to get it to search for a variety of formats, and having some success with a wildcard search. But I’m stuck on searching the format ‘9/25/2014’.

The wildcard expression I’m using for this, "([0-9]{1,2})(/)([0-9]{1,2})(/)([0-9]{2})", finds both dates with 2- and 4-digit years. The code highlights '9/25/20’ and ignores the ‘14’ (as it should because of the {2}), but I want to find a way to have it search ONLY for dates with 2-digit years, instead of reading only the first 2 digits of 4-digit years. Been trying other wildcard switches but nothing achieves this specific search.

Can I get some help? Code is in the attached.
Attached Files
File Type: txt Format_All_Dates.txt (771 Bytes, 7 views)
Reply With Quote