Move the string that matches the regex to the end
Posted: 30 Nov 2020, 07:17
I have the following problem to solve it in JavaScript:
- Find the text which is between small brackets and shift that text with the brackets to the end of the string, using regex.
Let say I have this string:
It must result:
- Find the text which is between small brackets and shift that text with the brackets to the end of the string, using regex.
Let say I have this string:
Code: Select all
let str ='Have a (good) life';
Code: Select all
let str ='Have a life (good)';