Advertisement
Guest User

regex modification

a guest
Jan 4th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. <?php
  2. $data2 = "https://img1.steemit.com/250x0/https://f4.bcbits.com/img/a0889057905_16.jpg
  3. I’ve been working on this EP for the last two years. *Bluegreen* lives somewhere between Electronica, Chillout and Dub. With these tracks I wanted to capture four different moods, each different and yet in harmony with the others. Blurring the lines of musical genres I’ve put a lot of time and attention to detail in every sound in the records. The EP is free and can be downloaded from my [Bandcamp page](https://rossenpavlov.bandcamp.com/). You can also support my music by buying the tracks with whatever price you name, or send me some steem.";
  4. $data = "http://guardianlv.com/wp-content/uploads/2014/03/Robots-The-Possibilities-of-Artificial-Intelligence.jpg In the past 200-300 years we went through the Industrial Revolution, Technological revolution, Digital revolution. Each and one of them more awesome than the other. But I’m waiting for the Robotics revolution. I think humanity, it’s heading towards a world where robots and robotics will be an integrated part of the daily life. Just like in the SF movies, the robots will be doing all the meager tasks, that we hate to do anyway. At the moment I don’t think we are prepared for such kind of revolution. We are still frowning when we hear that X amount of people lost their jobs and got replaced with robots, or apps or AI’s. We are thinking that we will lose our purpose if we will give tasks to someone else. We are fearing that we won’t have any meaning on this planet. This is why most of the people are afraid of the robots. *Of course, movies like Terminator could have been one of the motives people are afraid of robots.* I think robots will make our life easier and it will help us to focus on important things like life, health, relationships. We won’t have to think each day how to survive, we won’t have to go to a job, a job that many (too many) people hate. I think a robotics revolution will help humanity to enter in a new enlightened age, where people will be focusing on arts and philosophy, or we will finally be able to explore the galaxy and maybe the Universe. A good example on how robots can improve our life it’s steemit. Many of us are using robots for voting when we are busy with other parts of our life. While we are doing other things, our robots are placing votes in our place, sharing the love on steemit. And that can be only a good thing right? What do you think about robots? How will they shape our world and life in the future? [image source](http://guardianlv.com/wp-content/uploads/2014/03/Robots-The-Possibilities-of-Artificial-Intelligence.jpg)";
  5. function filter_post($data)
  6. {
  7. $output = preg_replace("/(<img[^>]+\>)|(http(?:[^\s]*)\.(?:jpe?g|gif|png))/", '', $data);
  8. echo "output:";
  9. echo "<br/>";
  10. echo $output;
  11. //return $data;
  12. }
  13. function get_remote_images_from_content( $content ) {
  14. $images = $matches = array();
  15. if ( preg_match_all( '/(?:<img.*?src=[\'"](.*?)[\'"].*?>)|(http(?:[^\s]*)\.(?:jpe?g|gif|png))/is', $content, $matches ) ) {
  16. $matchKeep = [];
  17. if (!empty($matches[1][0]) && empty($matches[2][0])) {
  18. $matchKeep = $matches[1];
  19. }elseif (!empty($matches[2][0]) && empty($matches[1][0])) {
  20. $matchKeep = $matches[2];
  21. }
  22. foreach ( $matchKeep as $url ) {
  23. $images[] = $url;
  24. }
  25. }
  26. echo "images:";
  27. echo "<br/>";
  28. print_r($images);
  29. //return $images;
  30. }
  31. filter_post($data);
  32. //get_remote_images_from_content($data);
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement