oussama kamal oussama kamal - 2 months ago 27
Javascript Question

Split and add <br> tag to concatenated dates in Javascript

I have a string in javascript that looks like: 11/25/1612/02/1612/09/1606/03/17
The string can have many dates concatenated.

How can I place an HTML
tag between each date of that string so that the output will be 11/25/16 br 12/02/16 br 12/09/16 br 06/03/17



Use String#replace method.

  '11/25/1612/02/1612/09/1606/03/17'.replace(/(?:\d{2}\/){2}\d{2}(?!$)/g, '$&<br>')