开发者

preg_replace REGEX

开发者 https://www.devze.com 2023-04-10 09:01 出处:网络
I wanted some help开发者_运维问答 regarding REGEX. I have the following in a string variable after scraping from a website.

I wanted some help开发者_运维问答 regarding REGEX.

I have the following in a string variable after scraping from a website.

16:50 to 17:50 OOPS LAB : Scheduled Class : Shikha Jain : E1-0LA4 Download Course materials 15:45 to 16:45 OOPS LAB : Scheduled Class : Shikha Jain : E1-0LA4 Download Course materials 14:40 to 15:40 FR - III : Scheduled Class : Ravi Shankar Kumar : E3-218 Download Course materials  

What i want to do is, get rid of the " Download Course materials" part. I tried the str_replace and preg_replace but they all kept failing to replace successfully. Please help. Thanks.


Note that the ampersand has been replaced by an entity:   (thanks Viktor) :

$new_string = str_replace(' Download Course materials', '', $your_string)

Should do the job.

0

精彩评论

暂无评论...
验证码 换一张
取 消