C# Regex match anything inside Parentheses

前端 未结 5 1951
庸人自扰
庸人自扰 2020-12-29 06:12

I want to match anything inside parentheses but the result must exclude the parentheses as well.

Examples:
Initialize(P90W)
Brake(45X)

5条回答
  •  一向
    一向 (楼主)
    2020-12-29 06:56

    try regex @"\((.*?)\)"

    EDIT: Also the result will be group 1 not 0, group 0 should contain the entire regex result, not the first parenthesized value

提交回复
热议问题