burnsj2
asked on
regex question
Does anyone know how I get can the quoted code into an array with just the filenames with PHP/regex.
desiered aray: array(0 => 'tn_21-b196054175f.jpg', 1 => 'tn_21-b196054175.jpg' ... n => 'nth_filename.jpg')
So basically the array just has the filenames from all of the <img> tags (the number of img tags varies, igoring the directory paths and the href.
Thanks!
desiered aray: array(0 => 'tn_21-b196054175f.jpg', 1 => 'tn_21-b196054175.jpg' ... n => 'nth_filename.jpg')
So basically the array just has the filenames from all of the <img> tags (the number of img tags varies, igoring the directory paths and the href.
Thanks!
<a rel="rokzoom" href="components/com_productbook/img_originals/21-b196054175f.jpg">
<img src="components/com_productbook/img_thumbnails/tn_21-b196054175f.jpg" alt="" /></a>
<a rel="rokzoom" href="components/com_productbook/img_originals/21-b196054175.jpg">
<img src="components/com_productbook/img_thumbnails/tn_21-b196054175.jpg" alt="" /></a>
.
.
.
<a rel="rokzoom" href="components/com_productbook/img_originals/nth_filename.jpg">
<img src="components/com_productbook/img_thumbnails/nth_filename.jpg" alt="" /></a>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh, I hope you are familiar a bit with regex, how you do the php specific stuff... i havent coded php since years and I'm not very sure, how to use regex on php. but that should be easy.
ASKER
This does not seem to work with PHP who's regex's are perl compatible.
My current code:
preg_match_all('src=".*\/( [^.|^\/]*. jpg)"',$no te,$altRes ults,PREG_ PATTERN_OR DER);
print_r($altResults);
where $note is the input text in the original question. print_r outputs: Array( )
My current code:
preg_match_all('src=".*\/(
print_r($altResults);
where $note is the input text in the original question. print_r outputs: Array( )
ASKER
This regex does seem to work on some platforms, so I'm closing this and will post for a PHP specifc answer.
Thanks,
Thanks,