I faced the following problem. My string contains math expression. For example like this:
5+|-2|
And I need to convert it to
5+Math.abs(-2)
I can do it with loop (check if the vertical bar is met the first time, replace it on the Math.abs(
, second - replace on the )
). But is there any way to do it with Regex in Kotlin? Thanks in advance for any help!