Timeline for Function to remove specified html tags from string
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 2, 2017 at 19:18 | answer | added | bart | timeline score: -1 | |
Jul 28, 2017 at 5:28 | answer | added | I wrestled a bear once. | timeline score: 2 | |
Jul 27, 2017 at 20:05 | vote | accept | GrumpyCrouton | ||
Jul 27, 2017 at 19:44 | answer | added | Siegen | timeline score: 4 | |
Jul 27, 2017 at 19:26 | answer | added | Conor Mancone | timeline score: 4 | |
Jul 27, 2017 at 19:19 | history | edited | GrumpyCrouton | CC BY-SA 3.0 |
Fixed a mismatched parenthesis error that I somehow made
|
Jul 27, 2017 at 19:10 | history | edited | 200_success |
edited tags
|
|
Jul 27, 2017 at 19:09 | history | edited | GrumpyCrouton | CC BY-SA 3.0 |
Added word boundaries to prevent incorrect matching
|
Jul 27, 2017 at 19:03 | comment | added | GrumpyCrouton | @ConorMancone Updated code fixes all the issues you mentioned i believe | |
Jul 27, 2017 at 19:02 | history | edited | GrumpyCrouton | CC BY-SA 3.0 |
Fixed another small issue with regex not working on elements with a space before the element type, E.G `< b>`
|
Jul 27, 2017 at 18:57 | comment | added | GrumpyCrouton |
@ConorMancone Actually I fixed that 2nd case with the class with my updated code, and the <span> would also be removed properly. The use-case is meant to be a string that you want to remove elements from before they ever see the page
|
|
Jul 27, 2017 at 18:55 | comment | added | Conor Mancone |
Ouch! Modifying HTML is not anywhere near as simple as it seems. Before I would attempt an answer to this, it is important to understand what your intended use case is. Because if you are intending to set this loose on arbitrary HTML from the internet, your particular implementation won't work, and a working implementation will require a completely different solution. Here are some snippets that your code will not work for: < b>Name</b> , <div class="myclass"></div> , <span> (broken HTML, which browsers still parse), etc... You need an actual parser to mess with HTML: regexps won't do.
|
|
Jul 27, 2017 at 18:53 | history | edited | GrumpyCrouton | CC BY-SA 3.0 |
Small update to the regex to allow matches for tags with other data in-line
|
Jul 27, 2017 at 18:37 | history | asked | GrumpyCrouton | CC BY-SA 3.0 |