Automate Getting the Start of Lines that Aren't HTML Formatted

This regex of the day is great for helping you format content into HTML.

Say we need to put paragraph tags around the text that doesn't already have an HTML tag.

The pattern we want is whenever we start the line without a less-than bracket.

We'll use the "start with" token (^), then the "not" set ([^...]) which includes our bracket.

^[^<]

Let's turn on regular expressions.

Now we are capturing the start of each paragraph that isn't yet HTML formatted.

With a little VS Code keyboard shortcut, we can add a cursor for each paragraph. Hit Alt + Enter for Windows and Option + Enter on Mac. Zoom to the beginning of the line with CTRL / CMD + Left arrow and start typing your tag. Zoom to the end with CTRL / CMD + Right arrow, right arrow to close your tag and you're done.