Get the latest tech news

The /o in Ruby regex stands for "oh the humanity "


Your code using the /o modifier Source: wikipedia Hi there! Do you like Regex? Do you like performance? Do you like creating confounding bugs for yourself rooted in the mechanics of the Ruby VM itself? If you said yes to all of the above, have I got a feature for you! But first, let’s start with a story. The cliffs of insanity I was recently reviewing some code, and part of the functionality was about matching.

With nothing else to investigate, I finally looked up the docs for what the/o regex modifier does./o is referred to as “Interpolation mode”, which sounded pretty harmless. It contains all of the available YARV (Yet Another Ruby VM) instructions in a C-esque format which is compiled into an actual C file as part of building the language. In a moment of pure serendipity, the day after I started writing this post I happened to read Jared Norman’s Code Reloading for Rack Apps.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Humanity

Humanity

Photo of ruby

ruby

Photo of Ruby regex

Ruby regex

Related news:

News photo

How a few online users make the internet – and humanity – look worse than they are

News photo

Ruby 3.4 frozen string literals: What Rails developers need to know

News photo

Brut: A New Web Framework for Ruby