#166 Regex

brian Wed 26 Dec 2007

I've added the basic Regex APIs. I've been basing my stuff on the Python and Java APIs which are similar, although my API is pretty much a clone of the Java API which seems pretty well done. Originally I thought we should have Regex literals like Ruby - I'm not so sure now, but we can always add them later. There is still a lot of stuff left before we have a fully functional API, but we have enough to do matches and what we need for the WebService configuration.

Also as part of this effort, I added support for raw string literals like Python: r"c:\foo\bar.txt".

tompalmer Sun 20 Jul 2008

What is the status of the regex system in Fan? I reckon it's an independent system designed to be portable? (Side note, it would be sweet if it compiled dynamically to fcode and lower levels for high performance.)

brian Sun 20 Jul 2008

The existing API works. It maps to Java's implementation on the JVM. There is a minor incompatibility with .NET's implementation. You should be able to do most basic things with it today.

My plan is to flush the API to match Java's API pretty closely. I'm hoping the .NET implementation is close enough to achieve portability when we dig into it.

tompalmer Sun 20 Jul 2008

I hope so. I think compatibility on this front is important.

helium Sun 20 Jul 2008

I recently had a problem with Java's RegEx:

^foo|bar

seems to mean

^(foo|bar)

in java, but

(^foo)|bar

on all other implementations I know of. So in Java it doesn't match

some text that contains bar

And that's not a terribly complex RegEx, is it? So compatibility isn't too good.

Login or Signup to reply.