Regex expresssion help

I'm trying to save the file and I need to append dates to the splitted pdf.

The pattern is "Closing Date 3/01/13 thru 3/31/13"

I need to include 3/31/13. what is the best way to extract it?
zachvaldezAsked:
Who is Participating?
 
MazdajaiConnect With a Mentor Commented:
You can extract it from $1 -

(\d{1,2}\/\d{1,2}\/\d{1,2})$

Open in new window

0
 
zachvaldezAuthor Commented:
What you mean?
you can extract from$1
0
 
MazdajaiCommented:
$1 is a backreferencing in regex you can refer to if you have parentheses () around.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
käµfm³d 👽Commented:
Please provide a better description of what you are trying to do. It's not clear what you hope to gain from a regex based on your OP.
0
 
zachvaldezAuthor Commented:
I hope this is clear. From this pattern,
"Closing Date 3/01/13 thru 3/31/13"
how will I get.   3/31/13?
0
 
käµfm³d 👽Commented:
What language or text editor are you using?
0
 
zachvaldezAuthor Commented:
I'm reading a PDF file. I don't use any editor.  I'm just looking for a regex formula.
0
 
käµfm³d 👽Commented:
Then Mazdajai's suggestion should be what you need. If the tool doesn't support that syntax, then you might adjust it to:

([0-9][0-9]/[0-9][0-9]/[0-9][0-9])$

Open in new window

0
 
zachvaldezAuthor Commented:
yes, my date pattern pre Y2k as in
x/x/xx

or xx/xx/xx

what is the regex pattern to accommodate the month and day which can be either
1 or 2 digits?
0
 
zachvaldezAuthor Commented:
this is what I m trying to work on..
Since the search pattern is "thru 3/31/13"


(?<=thru \d{1}/\d{2}/)\d{2}  results to 13
(?<=thru )\d{1}(?=/\d{2}/\d{2}) results to 3
(?<=thru \d{1}/)\d{2}(?=/\d{2}) results to 31

But this regex pattern may not work if month has 2 digits and day has 1 digit.
I have to cover all possibilities.
Let me know what will I need to modify

I have to individually extract the digits.  thanks
0
 
käµfm³d 👽Commented:
Have you tried Mazdajai's suggestion? The {1,2} he proposed should handle either a 1- or 2-digit day or month.
0
 
zachvaldezAuthor Commented:
I tried but it's not appending the date.
0
 
MazdajaiCommented:
what is the output when you use the regex I posted?
0
 
zachvaldezAuthor Commented:
It does not append the values.
I think it should be done in 3 lines.
for year,month,date.
0
 
MazdajaiCommented:
Can you post the output you are getting?
0
 
zachvaldezAuthor Commented:
It's not reading it. so I have a blank output. I use this..

(thru\d{1,2}\/\d{1,2}\/\d{1,2})$

the input is 3/31/13
the output I expect should be displayed

13331


 but Id like it ot show as 20130430
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.