我在 swift 中有这样的新行字符串:
如何从该字符串中删除所有时间戳 (11.03.2016 22:46:16)?
最佳答案
最简单的方法是将字符类与 anchor 相结合:
^[\d. :]+(.+)
# anchor it to the beginning of the line
# only digits, spaces, dots and a colon allowed
# one or more times
# the (.+) brings you down the line
这里只带第一个捕获的组。
查看此方法的演示 here on regex101.com
关于regex - 用于从对话中删除所有日期时间的正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36409386/