I have a regex that matches everything inside the brackets:
?\(.*?\)
I need to adjust this regex, so it also matches nested brackets, for example:
ABC ( DEF (GHI) JKL ) MNO
Must match (DEF (GHI) JKL) in this example
To match ( DEF (GHI) JKL )in ABC ( DEF (GHI) JKL ) MNO, you must change .*?to .*regex in your example:
( DEF (GHI) JKL )
.*?
.*
\(.*\)
.*? - lazy - it will correspond to the shortest possible line;
.* is greedy - it will match the longest possible string.
If you want to combine:
ABC (DEF (GHI) JKL) MNO
:
?\(.*\)
: https://regex101.com/r/5Y5ZM0/2
EDIT: @GameDroids
Source: https://habr.com/ru/post/1692372/More articles:Convert elements to tensorflow array using dictionary - pythonAdding space around shapes in RMarkdown - rBindingList equivalent of a dictionary in WinForms - dictionaryReplace values ββin a dictionary-based NumPy array and avoid matching between new values ββand keys - pythonIs there a way to save a custom matplotlib matrix template for use elsewhere? - pythonBoto3 does not support decryption service - pythonHow to display & Delta; in Highcharts shortcuts? - highchartsUnknown botocore service error - pythonHow to gracefully determine when all Promises are rejected? - javascriptHow to implement an equatable protocol for a protocol based on the identity of two instances that implement this protocol? - iosAll Articles