Read The Bleepin’ Manual

Nerdy Text Wizardry

ZOMG, so you wanna learn about Regular Expressions? They're basically witchcraft for text files & they let you do crazy pattern-matching stuff. Plus, you can grab whatever you find & transform it into something else. Yeah, they look like alphabet soup from a robot's nightmare, but hey—literally every computer platform speaks this gobbledygook the same way. Wanna nerd out? Check out the full deets on regex right here.

Let's say you wanna hunt down all those bracketed chords cluttering up your song. Here's what you'd type into the OnSong search field (no pressure):

/\[(.*?)\]/i

Okay, So What Are We Actually Matching?

First thing's first—those forward slashes are like the regex bouncer at the club. They're sayin' "Hey, everything between us is a pattern & some rules." In this hot mess, [(.*?)] is your actual pattern & i is the modifier that's gonna chill things out.

Backslash? Really? (Escaping Text)

Yeah, regex is its own whole thing, & it's basically a bunch of special keyboard characters that mean special stuff. In our example up there, that first backslash is like a "hold up, treat this next thing NORMAL" sign. Why? 'Cause square brackets are like the VIP room of regex—they mean "find a range of characters" by default. So we throw a backslash in front to be like "nah fam, just a regular bracket tho."

Match Groups (aka "The Keepers")

See those parentheses wrapped around stuff inside the square brackets? Those bad boys are "groups"—they basically say "SAVE THIS PART." We're puttin' parentheses around our main thing 'cause we're gonna steal that match & use it later in the replace field. Sneaky, right?

The Actual Pattern

Inside those parentheses lives a period . — That's code for "literally ANY character." We want it there 'cause we're huntin' for brackets that actually contain something, y'know? Then boom—an asterisk ***** shows up. That means "gimme zero or more of whatever came before." So we're basically sayin' "find ANY number of characters." But WAIT—there's a question mark ? chillin' there too. That creates a "non-greedy search," which is fancy talk for "don't be a glutton." Without it, regex would be like "MINE. EVERYTHING BETWEEN BRACKETS IS MINE" & you'd lose your whole dang song. With it? We stop the SECOND we hit a closin' bracket. Boom. Precision.

Modifiers (The Rule-Changers)

These live after the forward slashes & they tell regex to behave differently. Each character is its own modifier. Mix & match as needed:

  • i = "I don't care if it's BIG or small letters." Case is dismissed. Literally.
  • x = "Throw in whitespace & comments if ya want." Regex gets chatty.
  • s = "Let the dot match line breaks too." By default, regex is a line-by-line kind of thing. This changes that.
  • m = "Make FRESH HOTNESS and $ work at the start & end of EACH line, not just the whole thing." Basically multi-line mode unlocked.
  • w = "Use fancy Unicode word boundaries." If you flip this on, OnSong gets all sophisticated & figures out where words start & stop using Unicode standards. Fancy!

TL;DR: This whole pattern finds whatever's chilling between two square brackets (in a non-greedy way) & gets it ready for you to do whatever you want with it.

Replacement (aka "The Swap")

You could literally just delete all your chords using that pattern above & replacin' it with... nothin'. Poof. Gone. But you're smarter than that. You can grab that match group you saved & wrap it in somethin' else. Like, say you type this into the OnSong replace field:

<$!>

This takes that chord you found between the brackets & throws it inside angle brackets instead. Fancy remix, amirite?

2026.3 — Last Refreshed April 8, 2019