regex – Hackaday https://hackaday.com Fresh hacks every day Wed, 03 Dec 2025 17:18:52 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 156670177 FLOSS Weekly Episode 857: SOCification https://hackaday.com/2025/12/03/floss-weekly-episode-857-socification/ https://hackaday.com/2025/12/03/floss-weekly-episode-857-socification/#respond Wed, 03 Dec 2025 19:30:07 +0000 https://hackaday.com/?p=882796&preview=true&preview_id=882796 This week Jonathan chats with Konstantinos Margaritis about SIMD programming. Why do these wide data instructions matter? What’s the state of Hyperscan, the project from Intel to power regex with …read more]]>

This week Jonathan chats with Konstantinos Margaritis about SIMD programming. Why do these wide data instructions matter? What’s the state of Hyperscan, the project from Intel to power regex with SIMD? And what is Konstantinos’ connection to ARM’s SIMD approach? Watch to find out!

Did you know you can watch the live recording of the show right on our YouTube Channel? Have someone you’d like us to interview? Let us know, or have the guest contact us! Take a look at the schedule here.

Direct Download in DRM-free MP3.

If you’d rather read along, here’s the transcript for this week’s episode.


Theme music: “Newer Wave” Kevin MacLeod (incompetech.com)

Licensed under Creative Commons: By Attribution 4.0 License

]]>
https://hackaday.com/2025/12/03/floss-weekly-episode-857-socification/feed/ 0 882796 Pipewire
Bad Apple but it’s 6,500 Regex Searches in Vim https://hackaday.com/2025/01/11/bad-apple-but-its-6500-regex-searches-in-vim/ https://hackaday.com/2025/01/11/bad-apple-but-its-6500-regex-searches-in-vim/#comments Sun, 12 Jan 2025 06:00:00 +0000 https://hackaday.com/?p=753101 In the world of showing off, there is alongside ‘Does it play Doom?’ that other classic of ‘Does it play Bad Apple?’. Whereas either would be quaint in the context …read more]]>

In the world of showing off, there is alongside ‘Does it play Doom?’ that other classic of ‘Does it play Bad Apple?’. Whereas either would be quaint in the context of the Vim editor, this didn’t deter [Nolen Royalty] from making Vim play the Bad Apple video. As this is a purely black and white video, this means that it’s possible to convert each frame into a collection of pixels, with regular expression based search and custom highlighting allowing each frame to be rendered in the Vim window.

The fun part about this hack is that it doesn’t require any hacking or patching of Vim, but leans on its insane levels of built-in search features by line and column, adjusting the default highlight features and using a square font to get proper pixels rather than rectangles. The font is (unsurprisingly) called Square and targets roguelike games with a specific aesthetic.

First 6,500 frames are fed through ffmpeg to get PNGs, which are converted these into pixel arrays using scripts on the GitHub project. Then the regex search combined with Vim macros allowed the video to be played at real-time speed, albeit at 120 x 90 resolution to give the PC a fighting chance. The highlighting provides the contrast with the unlit pixels, creating a rather nice result as can be seen in the embedded video.

]]>
https://hackaday.com/2025/01/11/bad-apple-but-its-6500-regex-searches-in-vim/feed/ 7 753101 vim_bad_apple_nolen_royalty
Hackaday Links: August 11, 2024 https://hackaday.com/2024/08/11/hackaday-links-august-11-2024/ https://hackaday.com/2024/08/11/hackaday-links-august-11-2024/#comments Sun, 11 Aug 2024 23:00:45 +0000 https://hackaday.com/?p=699379&preview=true&preview_id=699379 Hackaday Links Column Banner“Please say it wasn’t a regex, please say it wasn’t a regex; aww, crap, it was a regex!” That seems to be the conclusion now that Crowdstrike has released a …read more]]> Hackaday Links Column Banner

“Please say it wasn’t a regex, please say it wasn’t a regex; aww, crap, it was a regex!” That seems to be the conclusion now that Crowdstrike has released a full root-cause analysis of its now-infamous Windows outage that took down 8 million machines with knock-on effects that reverberated through everything from healthcare to airlines. We’ve got to be honest and say that the twelve-page RCA was a little hard to get through, stuffed as it was with enough obfuscatory jargon to turn off even jargon lovers such as us. The gist, though, is that there was a “lack of a specific test for non-wildcard matching criteria,” which pretty much means someone screwed up a regular expression. Outside observers in the developer community have latched onto something more dire, though, as it appears the change that brought down so many machines was never tested on a single machine. That’s a little — OK, a lot — hard to believe, but it seems to be what Crowdstrike is saying. So go ahead and blame the regex, but it sure seems like there were deeper, darker forces at work here.

Congratulations, new parents; on top of everything else you’re dealing with, including raging sleep deprivation, there’s a good chance that your bundle of joy has just been bricked. It seems that something called a Snoo, an unbelievably expensive “smart bassinette,” has had its most useful features hidden behind a paywall, and parents are hopping mad. And rightly so; selling something for $1,700 with all the features activated only to pull back two-thirds of them unless the owner coughs up another $20 a month is a little unreasonable. Then again, back in the day we’d have gladly given someone twenty bucks a day if it helped get the kid to sleep, which the Snoo seems to do admirably well. And really, how long is the kid going to be in the thing anyway? Couple of months, tops. What’s another hundred or two when you’ve already spent nearly two grand? Still, we’d love to see someone hack one of these things, or even just do a teardown to see what makes it tick.

Dog lovers, listen up: the dog is OK. But not so much the dog owner’s apartment, as the not-goodest boy managed to burn the place down by gnawing on a lithium-ion battery pack. The entire event, which happened in Tulsa, Oklahoma in May, was captured on a security camera, which shows the moment the playful pup got his first mouthful of nastiness from a tooth penetrating the pack. The speed with which the fire took off is terrifying, but easy to understand since the dog bed where it started was essentially a big pile of tinder. Thankfully, the dog and his co-conspirators noped right out of the house through a doggie door, but it looks like the apartment was a total loss.

Have a project that needs a wiring harness? You might want to check out this cool harness designer. We haven’t had much chance to play with it yet, but it seems pretty cool. You select connectors, wire gauges, and lengths, and the app generates a BOM and wiring diagram.

And finally, in another case of the algorithm actually delivering for a change, we found this very good piece on the history of electrical distribution pylons. It’s heavily UK-centric, but that doesn’t get in the way at all. It not only goes over the history of pylons but also delves a bit into their engineering, both electrical and mechanical. As a bonus, it answers some of the questions you might never know you had, like what those little doo-dads attached to the wires near the insulators are.

]]>
https://hackaday.com/2024/08/11/hackaday-links-august-11-2024/feed/ 8 699379 Hackaday Links
Regular Expressions Finally Come to Microsoft Excel https://hackaday.com/2024/05/24/regular-expressions-finally-come-to-microsoft-excel/ https://hackaday.com/2024/05/24/regular-expressions-finally-come-to-microsoft-excel/#comments Sat, 25 May 2024 02:00:58 +0000 https://hackaday.com/?p=681303 There are two types of people in the world: those who have no idea what a regular expression is, and those who not only know what they are but can …read more]]>

There are two types of people in the world: those who have no idea what a regular expression is, and those who not only know what they are but can compose them on the fly and tend to use them in situations where they’re clearly not called for. And it’s that latter camp, of which we consider ourself a proud member, that is rejoicing with the announcement that Microsoft is adding regular expression support to Excel.

Or perhaps not rejoicing so much as wondering what took so long. Yes, regular expressions have been part of VBA for a while now, but the new functions allow you to use regexes right in the spreadsheet grid. There are plenty of caveats, of course. The big one is that this is still in beta at this time, so you have to do some gymnastics to enable it, if you’re even allowed to in the first place. Second, support appears limited to three functions at the moment: REGEXTEST, which provides a logical test of pattern matching; REGEXEXTRACT, which returns a substring that matches a pattern; and REGEXREPLACE, which substitutes a string for a pattern. The video below walks through how to use these functions within spreadsheets.

What’s also unclear now is what flavor of regular expressions is supported. There are a bewildering number of entities in the regex bestiary — character classes, positional indicators, quantifiers, subexpressions, lazy and greedy matches, and a range of grouping constructs that perplex even regex pros. One hopes these new functions will support one of the existing regex standards, but Microsoft is famous for “extending and enhancing.” Then again, regex support has been in the .NET Framework for years and is pretty close to the Perl standard, so our guess is that it’ll be close to that.

If you fall into the “What’s a regex?” camp but want to change that, why not get your grep on?

 

]]>
https://hackaday.com/2024/05/24/regular-expressions-finally-come-to-microsoft-excel/feed/ 29 681303 excel_regex
Galvanize Your Grip On Grep With This Great Grep Guide https://hackaday.com/2024/03/26/galvanize-your-grip-on-grep-with-this-great-grep-guide/ https://hackaday.com/2024/03/26/galvanize-your-grip-on-grep-with-this-great-grep-guide/#comments Wed, 27 Mar 2024 02:00:07 +0000 https://hackaday.com/?p=670708 Grep By Example is also available as a PDF Minibook, and a Grep playground helps you learn quickly.These days, you can’t throw a USB stick without hitting something that’s running Linux. It might be a phone, an embedded device, or your TV. Either way, it’s running Linux, …read more]]> Grep By Example is also available as a PDF Minibook, and a Grep playground helps you learn quickly.

These days, you can’t throw a USB stick without hitting something that’s running Linux. It might be a phone, an embedded device, or your TV. Either way, it’s running Linux, and somewhere along the line of the development of whatever your USB stick smacked into, somebody used the Global Regular Expression Print utility- better known as Grep. But what is Grep, and why do you need it? [Anton Zhiyanov] not only answers those questions but provides Grep by example: Interactive Guide to help you along.

Grep By Example is also available as a PDF Minibook, and a Grep playground helps you learn quickly.
Grep By Example is also available as a PDF Minibook, and a Grep playground helps you learn quickly.

To understand Linux, one must understand its commercial predecessor, Unix. One of the things that made Unix (and then Linux) unique was its philosophy: Write programs that work together, do one thing well, and handle text streams.  This philosophy describes a huge number of programs, and one of these programs is Grep. It’s installed everywhere there’s a *nix installed, and once one becomes familiar with it, their command-line-fu reaches an all new level.

At its core, Grep is simply a bloodhound. It’s scent? A magical incantation called Regular Expressions. Regular Expressions (aka Regex) are simply a way of describing what a stream of text should look like. So when you feed Grep a bit of Regular Expression, it Prints only the text that matches that expression. Neat, right?

The trouble is that Regex can be kind of hard, and Grep has various versions and capabilities that need to be learned. And this is where the article shines- it covers both in an excellent interactive tutorial that’ll help you become a Grep Guru in no time. And if you want to do a deeper dive, check out what it takes to make your own Regex Engine from scratch!

]]>
https://hackaday.com/2024/03/26/galvanize-your-grip-on-grep-with-this-great-grep-guide/feed/ 12 670708 grep-grip
Hackaday Links: October 30, 2022 https://hackaday.com/2022/10/30/hackaday-links-october-30-2022/ https://hackaday.com/2022/10/30/hackaday-links-october-30-2022/#comments Sun, 30 Oct 2022 23:00:59 +0000 https://hackaday.com/?p=559826&preview=true&preview_id=559826 Hackaday Links Column BannerSad news for kids and adults alike as Lego announces the end of the Mindstorms line. The much-wish-listed line of robotics construction toys will be discontinued by the end of …read more]]> Hackaday Links Column Banner

Sad news for kids and adults alike as Lego announces the end of the Mindstorms line. The much-wish-listed line of robotics construction toys will be discontinued by the end of this year, nearly a quarter-century after its 1998 introduction, while support for the mobile apps will continue for another couple of years. It’s probably fair to say that Mindstorms launched an entire generation of engineering careers, as it provided a way to quickly prototype ideas that would have been difficult to realize without the snap-fit parts and easily programmed controllers. For our money, that ability to rapidly move from idea to working model was perhaps the strongest argument for using Mindstorms, since it prevented that loss of momentum that so often kills projects. That was before the maker movement, though, and now that servos and microcontrollers are only an Amazon order away and custom plastic structural elements can pop off a 3D printer in a couple of hours, we can see how Mindstorms might no longer be profitable. So maybe it’s a good day to drag out the Mindstorms, or even just that big box of Lego parts, and just sit on the carpet and make something.

Have you ever wondered what it sounds like when a solar storm crashes into Earth’s magnetosphere? We’re not sure the question has ever crossed our mind, but having heard the data from three European Space Agency satellites converted to audio, we can’t say it’s what we would have expected.  We’d have thought it would be something like the pings, snaps, and whistles of “Earth music”, but it’s something else entirely. There’s a lot in there; at first it sounds like a forest fire, then rattling chains followed by someone dropping a box of screws on the floor, all backed up by the sound of bubbling lava and heavy breathing. It’s truly creepy, so much so that it would make a great soundtrack for that Halloween haunted house. The data are from a solar storm that hit the Earth in 2011, when the Sun was just waking up again for the start of Solar Cycle 24; we can’t help but wonder what it sounds like now that we’re in Solar Cycle 25.

We spotted an alarming headline this week: “New Technique For Decoding People’s Thoughts Can Now Be Done From a Distance.” But as it turns out, the distance in question is approximately the radius of the bore of a functional MRI machine, since that’s where your head needs to be for this “new technique” to work. Previously, decoding the electrical impulses in a person’s brain required electrodes implanted deep within it, an invasive procedure that most people would probably not fail to notice having undergone. The fMRI method, which measures the flow of oxygenated blood in the brain as a proxy for neural activity, is certainly less invasive than the holes-in-the-head method, but again a reasonably alert person might notice the MRI machine jackhammering away around them. And it’s not even like this method actually reads thoughts in real time — the data have to be analyzed after the fact, and then only “decodes the semantic meaning” of what the user is thinking.

Commodore 64 fans will want to check out this collection of exotic C64s that never were. The past never looked so cool! The 64-TX, which has a standard C64 case with an LCD display and a chunky joystick mounted where the keyboard should be, is our favorite. There’s no build info, so it’s all just eye candy, but it’s pretty tasty and may serve as inspiration for those C64s you’ve got lying around.

If you’re as big a fan of regular expressions as we are, you’ll want to check out The Typing of the RegEx. Chris Johnson’s online game was inspired by The Typing of the Dead, except that instead of killing zombies with your words, you’re knocking out regexes that match ever-changing text prompts. Each round is timed, and there are bonus points for coming up with non-obvious patterns that match the input, so there’s a lot of pressure to perform. We’re a bit rusty with our regexes, so it only took a couple of rounds before tapping out. But it was fun to get back in the groove again.

And finally, what would Halloween be without the potential for your kids to bring home treats laced with foreign objects? We suggest you go through the treat bags carefully and if you see something like this, make sure you get it before the kiddies do.

 

 

]]>
https://hackaday.com/2022/10/30/hackaday-links-october-30-2022/feed/ 7 559826 Hackaday Links
13,000 Regular Expressions Make An Editor’s Life Easier https://hackaday.com/2021/02/01/13000-regular-expressions-make-an-editors-life-easier/ https://hackaday.com/2021/02/01/13000-regular-expressions-make-an-editors-life-easier/#comments Mon, 01 Feb 2021 09:00:06 +0000 https://hackaday.com/?p=458614 Being an editor is a job that seems deceptively easy until you are hauled over the coals for letting a textual howler go to print (or website). Most publications have …read more]]>

Being an editor is a job that seems deceptively easy until you are hauled over the coals for letting a textual howler go to print (or website). Most publications have style guides to ensure that their individual voice is preserved, but even the most eagle-eyed will sometimes slip up in their application. At the Guardian newspaper in the UK they have been struggling with this against an ever-evolving style guide that must adapt to fast-moving world events, to the extent that they had a set of regular expressions to deal with commonly-occurring problems. A lot of regular expressions, in fact around 13,000 of them.

Clearly some form of management was required, and  a team of developers set about taming this monster. The result is Typerighter, their server-side document-checker, which can be found in a GitHub repository. Surprisingly for rule management they started with a Google Sheet, a choice which proved unexpectedly robust when working with such a long list even though they later replaced it. The back end doing the job of text matching was written in Scala, and for the front end a plugin was created for their Prosemirror text editor.

For a publication of course this is extremely interesting, but where’s the interest for hackers? The answer lies in any text-processing engine that uses a lot of regular expressions; those of you who have dabbled in this space will know how unwieldy this work can become. Any user of computational linguistic techniques in the pursuit of language processing could probably find much of interest here.

If you’re a bit hazy on regular expressions, how about the episode on them from our long-running Linux-fu series?

]]>
https://hackaday.com/2021/02/01/13000-regular-expressions-make-an-editors-life-easier/feed/ 41 458614 typerighter-featured