python - How do I find text between brackets while including the bracket using regex tokenization -
how extract text inside brackets using regex? example if have
string = 'this test code [asdf -wer -a2 asdf] (ascd asdfas -were)'
i want output
[asdf-wer-a2-asdf], (ascd asdfas -were)
i have looked everywhere , haven't been able solve problem. if can me great
thank you
you can use below regex pattern. here example
\[[^\)]*\]|\([^)]*\)
Comments
Post a Comment