I have <br>
inserted into a string using some logic in typescript.
I wanted to remove the <br>
at the begining and end of the string. Others should remain as it.
What is the best way to achieve?
I achieved it using mystring.substring(mystring.indexOf('<br>'),mystring.lastIndexOf('<br>'))
Want to know if its the optimum way of doing this.
Its a little more complicated.. Should replace all the
in the starting of the string and ending of the string.
<br><br>hello<br>user<br><br><br> should return hello<br>user
|
$/g,'')` should work. However you ***must*** also read [*RegEx match open tags except XHTML self-contained tags*](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags). Also see [*regexp101.com*](https://regex101.com). – RobG Sep 26 '17 at 22:47
`, because you'd end up remove whatever comes after the last `
` – WindowsMaker Sep 26 '17 at 22:49