【问题标题】:Extract word or character after matched string excluding whiteSpace and matched string using regex在匹配字符串后提取单词或字符,不包括空格和使用正则表达式匹配的字符串
【发布时间】:2015-10-29 13:45:51
【问题描述】:

“1 杯希腊或天然酸奶。”

我想过滤掉杯子。

“1克盐。”

这里我想提取gm。

我想要一个正则表达式,它是两者的组合。

如有任何帮助,将不胜感激。

【问题讨论】:

  • 到目前为止你尝试过什么正则表达式?

标签: ios objective-c regex nsregularexpression


【解决方案1】:
/^(.+?)( cup|gm)(.+?)$/i

替换为

\1 \3

regex101

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-21
    • 2023-03-13
    • 2011-11-08
    • 1970-01-01
    • 1970-01-01
    • 2012-02-09
    相关资源
    最近更新 更多