On the QGIS Field calculator, I am trying to remove from a string the text that is inside parentheses using regexp_replace
.
While it is not a problem to remove the text from a string that contains only one parentheses group (using
regexp_replace('Steep (61° to 84°)','[(](.*)?[)]','')
it gives "Steep" as a result.
I am having some issues with extracting the text from a string where are present multiple parentheses, e.g.,
'Steep (61° to 84°), Vertical / Near Vertical (85° to 90°)'
From the above string, I would like to obtain
'Steep, Vertical / Near Vertical'
but if I try to use the same regex I obtain again only "steep", because for the system the closing parenthesis is the one at the end of the string.
regexp_replace()
on the whole string?steep
, because for the expression the last ) is at the end of the string.regexp_replace()
on substrings, which you define by whether they are before or after the comma?