
August 25th, 2008, 12:39 PM
|
|
Contributing User
|
|
Join Date: Feb 2008
Posts: 152
Time spent in forums: 1 Day 7 m 20 sec
Reputation Power: 0
|
|
|
Isolating results based on regular expressions
I'm currently retruning random data from DOM Parser. The only thing that I want to keep out of all the data is the dates. For example, everything below may varry except the FORMAT OF THE DATES:
aja ajlshfs d sd sdjfh sd fsd 2008/02/06 aklsd as dklas a sdkajs aslkd as da 2008/06/08 aslijas as asldhasjda sd asj as dasjdha sd 2008/11/12:
Is there a function I can use to say get rid of everyhting and leave me with anything matching the regular expression below. The key here is that the information surrounding the dates is not consistent. The FORMAT OF THE DATES is the only thing consistent. I want to isolate based on the pattern below:
PHP Code:
$pattern = '|^\d{4}/\d{1,2}/\d{1,2}$|';
As a result, I'm left with:
Code:
2008/02/06
2008/06/08
2008/11/12
|