匹配点的正则表达式 [英] Regular expression to match a dot

查看:61
本文介绍了匹配点的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道从 "blah blah blah test.this@gmail.com blah blah" 匹配 "test.this" 的最佳方法是什么?使用 Python.

Was wondering what the best way is to match "test.this" from "blah blah blah test.this@gmail.com blah blah" is? Using Python.

我试过 re.split(r"\b\w.\w@")

推荐答案

A . 在正则表达式中是一个元字符,用于匹配任何字符.要匹配原始 Python 字符串(r""r'')中的文字点,您需要对其进行转义,因此 r"\.";

A . in regex is a metacharacter, it is used to match any character. To match a literal dot in a raw Python string (r"" or r''), you need to escape it, so r"\."

这篇关于匹配点的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆