简体   繁体   中英

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)

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.

Thanks

You can try with the following regex:

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

Explanation:

  • (?<verb>[^(]+) : Group containing the verb
    • [^(]+ : combination of characters other than open parenthesis
  • : a space
  • (?<info>\([^\)]+\)) : Group containing the information
    • \( : open parenthesis
    • [^\)]+ : combination of characters other than closed parenthesis
    • \) : closed parenthesis
  • ? : optional ending space

Try it here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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