I have given the following string:
S = "I want to replace {something} and {this}, too"
I want to replace everything inside curly brackets. (Brackets included). So that I get:
"I want to replace X and X, too"
I have some trouble understanding the re module in the official erlang docs. What I managed so far with
re:replace(S, "(\{.*?\})", "X", [{return, list}]).
is to get:
"I want to replace X and {this}, too"
How can I use re:replace
so that all occurrences of the pattern are replaced?
Thank you!
I solved it thanks to @vinesh by providing the global
option like:
re:replace(S, "(\{.*?\})", "X", [global, {return, list}]).