0

I have the following text:

*<BR> Bullet1 *<BR>Bullet 2 *<BR>Bullet 3 *<BR>Bullet 4

I want to replace every *<BR> with <li> but also place a </li> at the end of the text (When it reaches a new *<BR> or can't find any)

The trick thing is that I also need a <ul> around all the li's to make it valid html.

I thought about using regular expressions but to honest I can't quite grasp the concept of it.

javac
  • 2,431
  • 4
  • 17
  • 26
Dumpen
  • 1,622
  • 6
  • 22
  • 36
  • 1
    Before questionning, what have you tried? – Maxime Lorant Jan 20 '14 at 15:27
  • My idea was to split the text with *, then see if the first word is
    , if it is then I replace it with
  • . But to honest this made it very messy and I was curious if there was any other way.
  • – Dumpen Jan 20 '14 at 15:29
  • One thing to note is that I believe `` can be implied rather than explicit so you don't necessarily need to place them (because opening another `
  • ` automatically closes the already open one and likewise `` will automatically close the open `
  • `. I assume this is still the case in HTML 5 but I've not checked. – Chris Jan 20 '14 at 15:47