News for hackers. Stuff that matters.
Re:Needle: A DFA Based Regex Library That Compiles to JVM By... by librasteve on Wednesday May 08, 2024 @04:12AM (#40295547)
looks very interesting - coming from the perl (ie the original PCRE) it’s rather a pity that this is focused on the JVM since Java is not the most regex friendly authoring environment (sorry I do not know if other JVM denizens like Kotlin / Clojure have more natural regex syntax)

Larry Walls version 2 of PCRE is doing some interesting innovation which, while continuing the model of a character level syntax where punctuation <[.+*]> and so on are the “verbs” as the regex Sub-Language (one of the Slangs of raku), now provides deep support for unicode (eg. a digit test looks at the unicode properties, not just <[0..9]>), and can be gradually unpacked using <token> and <rule> methods all the way up to a full blown composable class based Grammar … so you can still write regex one-liners perl style but then evolve that to a small Grammar to reduce line noise and drive up code clarity

Are there any plans to provide your library on the MoarVM?

Re:Needle: A DFA Based Regex Library That Compiles to JVM By... by hyperpape on Wednesday May 08, 2024 @06:46AM (#40296458)
Author here. I don't know much about the MoarVM, so no plans.

I have very idly thought about being able to output native code for use in other systems, but realistically, I have enough other ideas to keep my nights and weekends busy for a long time.

Re:Needle: A DFA Based Regex Library That Compiles to JVM By... by CoastalCoder on Wednesday May 08, 2024 @07:08AM (#40296623)
> the Slangs of raku

Sounds like the name of some race in a sci-fi story :)

Re:Needle: A DFA Based Regex Library That Compiles to JVM By... by MrBuddyCasino on Wednesday May 08, 2024 @09:08AM (#40297687)
Kotlin isn't too bad, you can avoid double-quoting and use .toRegex() on strings:

    val regex = """([\w\s]+) is (\d+) years old""".toRegex()