Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Help with Simple Find Dates with Regular Expression...need two digit year

$
0
0

Need some help with just a simple date finder that can do two digit years.
I just want it exported to another file with the list of lines containing dates.

The expression runs without error it just doesn't find any data and I have gone all the way to file level, but there are probably 50 date references in the format 08/22/16.

The latest expression I tried that found no dates is this one:

^((0?[13578]|10|12)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$/g

In the example it seems very much like it would find 2 digit year but I have 24 files of dates and it returns no values.

Select-String \\Path\*.txt -pattern "/^((0?[13578]|10|12)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$/g" -Context 0,1|Select-Object FileName, LineNumber,Line| export-csv \\Process\drive\Results\Dates.csv                                  

Any help appreciated.





Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>