RegEx忽略大小写 [英] RegEx Ignore Case

查看:385
本文介绍了RegEx忽略大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试创建一个可以忽略大小写的正则表达式。

I've been trying to create a regex which would ignore the casing.

这是我试图使用的正则表达式:

This is the regex i am trying to use:

/^[A-Za-z0-9._+\-\']+@+test.com$/;

所以基本上我想要匹配其中任何一个

So basically i would want to match any of these


  • abc@Test.com

  • abc@TEST.com

  • abc@teSt.com

我试过这个,但它不起作用:

I tried this, but it doesn't work:

/^[A-Za-z0-9._+\-\']+@+(?i)+test.com$/;

我在某处读过(?i)的使用,但找不到任何显示的例子他们在正则表达式中的用法忽略套管。
想到有人吗?非常感谢提前。

I read somewhere about the use of (?i), but couldn't find any examples which show their usage in regex to ignore casing. Thoughts anyone ? Thanks a lot in advance.

推荐答案

标语结束。

/regex/i

用于案例 - 不敏感(或忽略大小写)

i is for case-Insensitive (or ignore-case)

这篇关于RegEx忽略大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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