简体   繁体   English

搜索模式

[英]Search for patterns

I have a database that contains verbs and information about these verbs.我有一个数据库,其中包含动词和有关这些动词的信息。 The information is in parentheses and always follows the verb.信息在括号中并且总是跟在动词后面。 Example:例子:

tántyjë' ë chòn (5.53.3.1) bántyjë' ë chòn (5.53.3 1) nngwántyjë' é chòn (5.5.53.3.1) kwántyjë' ë chòn (5.53.3.1) tántyjë' ë chòn (5.53.3.1) bántyjë' ë chòn (5.53.3 1) nngwántyjë' é chòn (5.5.53.3.1) kwántyjë' ë chòn (5.53.3.1)

I am looking for an expression that isolates each verb followed by its information in brackets.我正在寻找一个表达式来隔离每个动词,后跟括号中的信息。 Example : tántyjë' ë chòn (5.53.3.1) This is 1 pattern.示例: tántyjë' ë chòn (5.53.3.1)这是 1 个模式。

Thanks谢谢

You can try with the following regex:您可以尝试使用以下正则表达式:

(?<verb>[^(]+) (?<info>\([^\)]+\)) ?

Explanation:解释:

  • (?<verb>[^(]+) : Group containing the verb (?<verb>[^(]+) : 包含动词的组
    • [^(]+ : combination of characters other than open parenthesis [^(]+ : 除开括号外的字符组合
  • : a space : 空间
  • (?<info>\([^\)]+\)) : Group containing the information (?<info>\([^\)]+\)) :包含信息的组
    • \( : open parenthesis \( : 开括号
    • [^\)]+ : combination of characters other than closed parenthesis [^\)]+ : 除右括号外的字符组合
    • \) : closed parenthesis \) : 右括号
  • ? : optional ending space : 可选的结束空格

Try it here .在这里试试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM