gpt4 book ai didi

php - 帮助使用 PHP 正则表达式提取字符串周围的文本

转载 作者:可可西里 更新时间:2023-10-31 22:47:55 25 4
gpt4 key购买 nike

我正在尝试使用正则表达式,但它让我伤透了脑筋。我会认为我有它,脚本就坏了。我需要尝试为人们提供一种通过短信报告位置的方法。我让他们给我发一个字符串,如下所示:

I give up, stopping for the night. Find me at Main Street and Pine, Atlanta, GA.

我想打破它在找到我。我需要捕获右侧的所有内容(基本上是他们的街角)并且我需要能够检测他们是否没有为 Find 使用正确的大写。

有什么建议吗?

最佳答案

preg_match("/[Ff]ind me at (.+)/", "I give up, find me at street 1 and street 2") 将捕获“find me”之后的所有内容在”

关于php - 帮助使用 PHP 正则表达式提取字符串周围的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6025267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com