I\'m having difficulty scraping dates from a specific web page because the date is apparently an argument passed to a javascript function. I have in the past written a few simpl
Why do you have two whitespace characters in your pattern?
$content =~ s/.*dateFormat\('(\d{4}\/\d{2}\/\d{2}\s{2})'\);.*/$1/;
^^^^^
they are not in your format example 'dateFormat('2012/02/07')'
I would say this is the reason why your pattern does not match.
Capture all dates
You can simply get all matches into an array like this
( my @Result ) = $content =~ /(?<=dateFormat\(')\d{4}\/\d{2}\/\d{2}(?='\))/g;
(?<=dateFormat\(')
is a positive lookbehind assertion that ensures that there is dateFormat\('
before your date pattern (but this is not included in your match)
(?='\))
is a positive lookahead assertion that ensures that there is '\)
after the pattern
The g
modifier let your pattern search for all matches in the string.