Which Regex Implementation Does Discourse Use?

I’m working on some regex stuff for an import project and I ran into some issues. Just curious, which regex implementation does Discourse use?

1 Like

I assume the built-in Ruby and Javascript ones.


Class: Regexp (Ruby 2.6.5)

When I run this in my Discourse repo:

bundle exec ruby --version

I get Ruby 2.6.5, so I’d refer to the Ruby docs at that version for specifics about their built-in RegEx engine :+1:

Thanks! This is what I was looking for.

1 Like

In case anyone else stumbles upon this thread,
I encourage you to check out:

I assumed wrongly just like @elijah over there: it’s actually Javascript-flavored.

Reach out to one of them if you’re still stuck :+1:

1 Like

Well the JS code uses JS regexps, and the Ruby code uses Ruby regexps. I’m not sure about things like setting validations, those regexps may have to be written to be valid in both. Luckily it looks like the two languages have mostly consistent regexp flavours.