简体   繁体   中英

Get string text file with start from specify character and end with specify character php code

I have text file with long word in it. I want display in php only some of this word. This word in my text file like this -

"NASA's Mission Control quickly radioed praise to the six-man space station crew: "Great work, guys." A brown toy dragon decorated the flight director's desk in Houston. Within minutes, the capsule was outside the NASA-controlled safety zone around the space station and under the complete jurisdiction of the SpaceX team in Hawthorne, Calif."

You can see in bold text, i want text after ":" and end with word "team". Anyone can help me for php code for this? Thank you.

If the text will never change , you can do this like so

preg_match('/:(.*?team)/',$text,$hit);
echo $hit[1];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM