I'm dealing with a website migration. Unfortunately the unordered list elements on the old website are formatted without using the ul
tag. So I would like to parse the following wrong markup to a common html ul
markup:
<p class="bodytext">
• This is some random text.<br>
• This is some other random text.<br>
• This is another random text.
</p>
Important facts:
- We are in the context of a post element, so there are a lot of bodytext classes
- The last list element has no br tag
- All list elements have this "bull" and 3x " "
- The amount of list elements is variable
I thought about a regex but I have no idea to tackle the mentioned problems, especially how to "detect" where to replace and how to match the last list item without
Any help would be appreciatted.
` with `
`. Use PHPStorm to auto-edit ending tag. 2. Replace all `dot ` to `- ` and append `
` to end of line (again use editor with multi-edit feature)
– Justinas Sep 20 '18 at 07:11