3007 posts
  • 5 Years of Membership
  • Affiliate Level 5
  • Author Level 9
  • Bundle Boss
+8 more
duotive
says
Wierd outcome…..
Array ( [0] => Array ( [0] => http://www.example.com/images/image1.jpg [1] => http://www.example.com/images/image2.jpg [2] => http://www.example.com/images/image3.jpg [3] => http://example.com/images/image4.jpg ) [1] => Array ( [0] => www.example.com [1] => www.example.com [2] => www.example.com [3] => example.com ) [2] => Array ( [0] => [1] => [2] => [3] => ) [3] => Array ( [0] => /images/image1.jpg [1] => /images/image2.jpg [2] => /images/image3.jpg [3] => /images/image4.jpg ) [4] => Array ( [0] => images/image1.jpg [1] => images/image2.jpg [2] => images/image3.jpg [3] => images/image4.jpg ) [5] => Array ( [0] => [1] => [2] => [3] => ) ) 
The problem is that this will be used for shortcodes… and lovely wordpress adds extra characters that we do not need…. that is why i was looking for regular expressions. If i only knew them…. but i find them wierd… lots of text that dose something…. never understood them.
2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+16 more
revaxarts
says

looks weird but isn’t ;)

  1. first array is an array all your urls (what you need)
  2. second array is an array with just the domains
  3. fourth array is an array with the paths
all arrays representing the content within the brackets:
          2st        3nd   5th4rd      6th
https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?

the first array is the whole pattern

2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+16 more
revaxarts
says

the third array should be the port

the 6th should be the query string

3007 posts
  • 5 Years of Membership
  • Affiliate Level 5
  • Author Level 9
  • Bundle Boss
+8 more
duotive
says

thanks.

3535 posts
  • Power Elite Author
  • Author Level 12
  • Trendsetter
  • United States
+13 more
sevenspark
Moderator
says


Can’t you just use the explode() function?
$urls = explode("\n", $url_str);
=)))) too simple to work but it did =)))) if anyone knows a regular than can do this it will be amazing, but in the time being this is very good. THANKS !!

No problem – glad it gets you going for the time being at least :)

701 posts
  • 7 Years of Membership
  • Affiliate Level 1
  • Canada
  • Collector Level 6
chrismccoy
says

thanks.
/<img.*?src="(.*?)".*?(/>|)/gi

should work for just the img/

by
by
by
by
by
by