如何替换文字字符串?
我需要一些有关 REGEX 的帮助。
从网站上抓取后,我在字符串变量中有以下内容。
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  
我想做的是,去掉“下载课程材料”部分。我尝试了 str_replace 和 preg_replace 但它们都始终无法成功替换。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,&符号已被实体替换:
(感谢 Viktor):
应该完成这项工作。
Note that the ampersand has been replaced by an entity:
(thanks Viktor) :Should do the job.