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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -