I have a data file that contains miscellaneous information on each line. (Unfortunately, I cannot go into detail of the file layout as it is sensitive information), but I can say that on each line are dates in multiple positions. Some areas of a line contain multiple dates, strung together because there is no separation between the fields (ie: no space(s)):
ie: 05/26/200706/03/200707/24/2007
As you can see, there are 3 dates above. Some have fields following each other that are as above, only there is at least one or more spaces between the dates:
ie: 05/26/2007 06/03/2007 07/24/2007
This is where it gets a little hairy. In some files, there is an arbitrary string of dates. The string of dates would look as follows:
ie: 07/24/2007 07/24/2007 07/24/2007 07/24/2007 07/24/2007 07/24/2007
There may be 2, 5, 7, or more dates, all strung together, but they are all the same date through the string on that line.
I am trying to write a regex that will match this arbitrarty string of identical dates, but unfortunately, it matches any string of multiple dates. Here is what I have so far:
Expand|Select|Wrap|Line Numbers
- if($line =~ m/(\d+\/\d+\/\d+\s*){2,}/)
- {
- print("Line Number $. ==> $line \n")
- }
07/24/2007 07/24/2007 07/24/2007 07/24/2007 07/24/2007 07/24/2007
and not any other, whether there are two dates or a dozen or so?
Regards,
Jeff