A gentle-ish introduction to RegEx for those whom poste

Table of Contents

- Introduction
- I want to match a single word
- I want to match on several different possible words
- I don’t want to match if the word is part of a bigger word
- I want to match something if it’s at the beginning of a post
- I want to match something if it’s at the end of a post
- I still need help

Introduction

Hello to rem and also everyone else I guess.

If you are reading this message, you may be a poste connoisseur. You may be a random passerby. You may not have any idea what the fuck I’m talking about.

However, most importantly, you may be someone trying to create your own custom feed on Bluesky using https://skyfeed.app/, which uses RegEx to filter posts

If you ask a programmer what a RegEx is, they will tell you that RegExes are a powerful tool that can do a huge number of things, about as many as you can imagine. And there are many resources online far better than mine which can teach you about RegEx.

I’m not here to do that. I’m here to teach you just enough to get by. So let’s go back to the beginning.

I want to match a single word

What’s the simplest algorithm you can think of? Possibly something like this

Give me all the posts that have the word “butt” in them

The RegEx you may use to express this particular desire is

butt

That’s it! The RegEx will look through the post and look for, quite literally, any post with the letter b, followed by the letter u, and two t’s (this also means it will match words like button and butter, but we’ll get to that later)

I want to match on several different possible words

Now that you’ve got your butt feed set up, you may want something a bit more inclusive! Possibly something like this

Give me all the posts that have the word butt, booty, or ass in them

This one is a little harder, but not by much. You would need to use the expression

butt|booty|ass

You can think of the horizontal seperator | like the word OR. The RegEx here is essentially acting as three separate RegExes smushed together, saying “I want the word butt OR i want the word booty OR I want the word ass”

I don’t want to match if the word is part of a bigger word

As you may have noticed if you’re following along in SkyFeed, your feed is showing posts with the word butt, but also bellybutton, buttery, and more. Although they’re perfectly fine words, we want to avoid this.

This is where the concept of anchors come in. We want a way to say

Give me all posts with the word butt, though not if there’s any other stuff before or after

To do this, we use “\b”. This is the word boundary anchor, and just indicates that you want the word to stop or start at the point where you insert the anchor

So, to get the word butt and not buttery, buttocks, or scuttlebutt, you would type in

\bbutt\b

This is a little harder to read, so to make it more clear, you can write

(\b)butt(\b)

This makes it more obvious what’s going on. You want the word to start, then contain the word butt, and then end

And yes, you can combine this with the previous expression to get something like

(\b)(butt|booty|ass)(\b)

I want to match something if it’s at the beginning of a post

Similarly, you may want to make sure your feed only contains posts that start with a particular word or phrase

Give me only the posts that start with the words “BUTT NEWS:”

To do this, you’ll use ^

(^)BUTT NEWS:

I want to match something if it’s at the end of a post

You may want to make sure your feed only contains posts that end with a particular word or phrase

Give me only the posts that end with the words ”- bootyfan143”

To do this, you’ll use $

- bootyfan143($)

I still need help

I think this will be about as most people need to get started, but if you have any specific questions or need help with anything, feel free to reach out on Bluesky (user @worm.gay) and I’ll either answer directly or update the guide 💖