Link to home
Start Free TrialLog in
Avatar of zachvaldez
zachvaldezFlag for United States of America

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zachvaldez

ASKER

What you mean?
you can extract from$1
$1 is a backreferencing in regex you can refer to if you have parentheses () around.
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.
I hope this is clear. From this pattern,
"Closing Date 3/01/13 thru 3/31/13"
how will I get.   3/31/13?
What language or text editor are you using?
I'm reading a PDF file. I don't use any editor.  I'm just looking for a regex formula.
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

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?
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
Have you tried Mazdajai's suggestion? The {1,2} he proposed should handle either a 1- or 2-digit day or month.
I tried but it's not appending the date.
what is the output when you use the regex I posted?
It does not append the values.
I think it should be done in 3 lines.
for year,month,date.
Can you post the output you are getting?
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