Regex is MAGIC πŸ§™β€β™‚οΈ

This is going to be a quick one, I should have included it in my post on “Printing the Internet” but I forgot.

I do more manual data manipulation then I care to, but one of the biggest helpers in these endeavors is Regular Expressions. (the biggest help, BY FAR, is VSCode’s multiple cursors).

My absolute favorite to use is something like:

<style([\w\W]+?)/style>

You can swap out the “style” for whatever tag you’re trying to alter or delete. That one takes the tags and everything inside of them (useful for inline style or .docx XML data), but if you need to keep the text in between, simply change it to:

<p([\w\W]+?)>

followed by using:

</p([\w\W]+?)>

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.