How to replace all image addresses with regular expressions

Source: Internet
Author: User
How to replace all image addresses with regular expressions




SpaceX announced the design scheme for the second generation manned "dragon" spacecraft, which can contain a maximum of 7 people



The US SpaceX company today released the second generation of Dragon V2, the first manned spacecraft launched by a private company to ship up to seven astronauts at a time to the International Space Station, according to NASA and SpaceX, Dragon 2 is expected to officially fly to space in 2017.



According to Elon Musk, co-founder of SpaceX, it can return to the Earth and "precisely land on any ground like a helicopter, and it can be quickly reused. You just need to re-inject the propellant, and then you can try again ...... Imagine that if the spacecraft is discarded after each task, no one will be able to afford this flight cost ." # P # subtitle # e #




Add a URL before an existing image address, similar to a http://www.xxxx.com/uploadpic/allimg/140603/23-140603131R9.jpg



Reply to discussion (solution)

$ S = <TXT

SpaceX announced the design scheme for the second generation manned "dragon" spacecraft, which can contain a maximum of 7 people

The US SpaceX company today released the second generation of Dragon V2, the first manned spacecraft launched by a private company to ship up to seven astronauts at a time to the International Space Station, according to NASA and SpaceX, Dragon 2 is expected to officially fly to space in 2017.

According to Elon Musk, co-founder of SpaceX, it can return to the Earth and "precisely land on any ground like a helicopter, and it can be quickly reused. You just need to re-inject the propellant, and then you can try again ...... Imagine that if the spacecraft is discarded after each task, no one will be able to afford this flight cost ." # P # subtitle # e #

TXT; echo preg_replace ('/

For non-complex ones, you do not need regular expressions.
$ Content = str_replace ('src = "', 'src =" http://www.xxxx.com', $ content );

If some Image addresses already have URLs, how can this problem be solved?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.