I am working on this yahoo pipe Regex and I found a bug I'm unable to wrap my mind around it.
I have a URL, from which I extract digits, cat them and make a img html tag and embed it. The issue is that, the URL is presented in a non padded way, but the image linked has the zeroes. Therefore, when there is a day or a month with single digits, the regex stops working.
This is what I have so far:
The URL: http://www.penny-arcade.com/comic/2009/1/2/patently-ridiculous/
The RegEx: (\d{4})/(\d+)/(\d+)
The Replacement: <img src="http://www.penny-arcade.com/images/$1/$1$2$3.jpg" />
What should appear: <img src="http://www.penny-arcade.com/images/2009/20090102.jpg" />
What appears: <img src="http://www.penny-arcade.com/images/2009/200912.jpg"/>
How could I parse those zeroes as to make this thing work?
If you can use more than one regular expression, here's a workaround:
search: (\d{4})/(\d)/ replace: $1/0$2/ search: (\d{4})/(\d{2})/(\d)/ replace: $1/$2/0$3/ search: (\d{2})/(\d{2})/(\d{2})/(.+)/ replace: <img src="http://www.penny-arcade.com/images/$1/$2$3.jpg" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With