这个正则表达式中的 (?i) 和 ?@ 是什么意思 [英] What does (?i) and ?@ in this regex mean

查看:111
本文介绍了这个正则表达式中的 (?i) 和 ?@ 是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的正则表达式中,(?i)"和?@"是什么意思?

In the following regex what does "(?i)" and "?@" mean?

(?i)<.*?@(?P<domain>\w+\.\w+)(?=>)

我知道那个?"表示零或一,并且我设置不区分大小写.

I know that "?" means zero or one and that i sets case insensitivity.

此正则表达式从 mailto 字段中的电子邮件地址捕获域,但不包括 @ 符号.它是从 SPLUNK 6.0.2 中生成的 erex 命令

This regex captures domains from an email address in a mailto field, but does not include the @ sign. It was generated the erex command from within SPLUNK 6.0.2

推荐答案

demo here : https://regex101.com/r/hE9gB4/1

demo here : https://regex101.com/r/hE9gB4/1

(?i)<.*?@(?P<domain>\w+\.\w+)(?=>)

它实际上是从电子邮件 ID 中获取您的域名:

its actually getting your domain name from the email id:

(?i) 使其不区分大小写和

?@ 只不过是 @ 与字符 @ 字面匹配.

?@ is nothing but @ which matches the character @ literally.

? 在你的 ?@.*? 的一部分,我们称之为惰性运算符,它会给你文本<@

the ? in your ?@ is part of .*? which we call as a lazy operator, It will give you the text between the < and @

如果在 .* 之后不使用 ? ,它将匹配 < 之后到最后的所有内容.(我们称之为贪婪运算符)

if you dont use the ? after the .* it will match everything after < to the end. ( we call this as the greedy operator)

这篇关于这个正则表达式中的 (?i) 和 ?@ 是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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