gpt4 book ai didi

regex - 使用正则表达式检索字符串的最后 3 个单词

转载 作者:行者123 更新时间:2023-12-04 15:32:26 25 4
gpt4 key购买 nike

<分区>

我正在尝试使用正则表达式检索字符串的最后 3 个单词。

字符串-“从2019年7月19日的地方”

我只需要提取日期部分“2019 年 7 月 19 日”。

我尝试了以下方法:-

(\w{3})$             # gives last 3 letters of the last word
([,0-9]{3})$ # gives last 3 digits from the last word
(?:\w+\s*){1,3}$ # retrieves only the last word

他们都没有给我最后 3 个词。

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