Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I use the same regular expression in different programming languages?
    primarykey
    data
    text
    <p>I've seen <a href="https://stackoverflow.com/questions/1973343/regular-expressions-same-for-all-languages">this question</a>, and I know from experience that every language seems to support a different dialect of regex. I figure the problem has been around for a long time, so <em>somebody</em> must have wanted to do something about it.</p> <p>I have a pretty big project that involves JavaScript, Ruby, and Java, and all of them have to touch the same regular expressions. We picked Java as our "official" RE interpreter, which means that any time the other two languages need to evaluate an RE, they have to somehow pass it to a Java program, and that's starting to add up to a lot of overhead.</p> <p>If I could pick <em>any</em> RE dialect and invoke that at least semi-natively from all the languages, it'd be a huge step forward for us. Is this possible? Is it being done already? We looked at PCRE, and it's <em>technically</em> possible to invoke it via native bindings from Java and Ruby (though it leaves JS out in the cold), but I haven't found anybody actually doing it. Are we alone?</p> <p>ETA: a wrinkle I did not mention is that this system applies <em>user supplied</em> regex. (Yes, I understand that this is a <a href="https://stackoverflow.com/questions/4289923/in-which-languages-is-it-a-security-hole-to-use-user-supplied-regular-expression">security issue</a>, etc, but it's for in-house use by trusted, attributed users.) I can certainly suggest putting up a list of "don't do this" power-features to avoid, but I kind of hope it's not the best solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload