使用正则表达式选择括号 [英] Using regex to select the brackets

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

问题描述

目标:

如果(+)内的数据包含字母和包含括号的数据,那么它就是真的。



但是如果它包含任何数字的数据,包括括号,那么它将是假的。





问题:

我不知道如何解决它包括括号。



http://regexr.com/3d0dh

通过查看代码,选择不包括括号



谢谢!





 sdf(ff)
回答: true

dddd(335g)ddd
答案: false

sdf(f344f )21ff
回答: false

sdf(dd)433dd
回答: true





我尝试过:



我编写了正则表达式代码,我也做了一些研究,但不幸的是我仍然找不到答案或部分答案。

解决方案

< blockq uote>试试这个:

 \([a-zA-Z] + \)



学习: 30分钟正则表达式教程 [ ^ ]


Goal:
If the data inside of the "(" + ")" contains data that is alphabet and included brackets, then it is true.

However if it contain data that is any number, included brackets, then it will be false.


Problem:
I don't know how to solve it in relation to including brackets.

http://regexr.com/3d0dh
By reviewing the code, the selection does not include the brackets

Thank you!


sdf (ff)
answer: true

dddd (335g) ddd
answer: false

sdf(f344f) 21ff
answer: false

sdf(dd) 433dd
answer: true



What I have tried:

I have coded the regex code and I also have made some research but unfortunatly I still cannot find the answer or part of the answer.

解决方案

Try this:

\([a-zA-Z]+\)


Learn: The 30 Minute Regex Tutorial[^]


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

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