ID:617285
 
Keywords: regex
Resolved
Regular expressions are now supported with the new /regex datum and matching regex() proc.
Applies to:DM Language
Status: Resolved (510.1320)

This issue has been resolved.
It's been mentioned in the past many times before, and Tom and Lummox have shown some form of interest in getting proper Regex support in DM beyond Lummox's library.

I wanted to re-open this issue because I've used PCRE quite a bit and find its license suitable for usage in an application like BYOND. The BSD license permits redistribution in binary or source code form either modified or unmodified as long as the copyright notice remains intact and the license remains intact. That doesn't seem like too much of a stretch.
I'm going to bump this because this would be nice to have.
Lummox JR is always talking about how every feature relating to inputs or whatever would require Regex support. Well, here it is. SSX supports.
C++11 comes with built-in regex in the library, there's no need to use anything external.
BYOND uses like, C++1. (or 98, probably.)
BYOND will never use a newer C++ standard because it is compiled with an older, unsupported compiler. They accept this.
If it's compiled with VC6++ (or whatever it's name) then there could be problems, but anything later than that shouldn't cause any problems. If they use gcc there should be even less problems.
It's compiled with exactly that, Visual C++ 6.0.
Ouch...

I haven't used VC++6, but I can't imagine it causing a lot problems. I've tried compiling some old sources and only for() loops needed fixing.
Either way, that's slightly irrelevant. PCRE is a solution that should work perfectly fine even with their compiler choice and it has a compatible license.
In response to Audeuro
If PCRE doesn't have VC++6 source there's chance it won't work either.

VC++6 isn't really C++ as it doesn't follow C++ standard.
It doesn't need to have "VC++6 source." MSVC++ 6 is legitimate C++. No compiler strictly follows any of the standards, they're all flawed in some way. Generally, you assess a compiler by just how compliant it actually is. In light of this, it's true that back in its day MSVC++ 6 was pretty low-ranking as far as standards compliance, but mostly as far as templates (and thus, the STL) were concerned.
This is an old thread, but chances are nothing has changed - it doesn't compile:
http://www.mail-archive.com/[email protected]/msg01371.html

Edit:
What's wrong with using external .dll? It would be almost trivial to make few functions to utilize regex library. So far I cannot see anyone mentioning this solution, not sure about disadvantages.
An external DLL works fine. In our case we use a modified version of Kuraudo's libregex library. Modified because AFAIK his original library had some a buggy Linux version of his DLL. I fixed that by manually recompiling it.
I'm dredging this back up from the depths, since we're looking to add regex support to SS13, and this is the most recent thread about it according to Google. Several abortive attempts have been made already by other code branches to add regex. I still have several licensing concerns about using Lummox's library (which I'll direct to the appropriate thread), but it still highlights a huge deficiency in BYOND.

Regex is now a staple of most modern programming languages, and for good reason: It's far simpler to use a regular expression than to manually build and debug a custom string parser.

I realize that just stapling in PCRE isn't going to work (I've already evaluated that it's impossible to use with call() without an adapter library), but quite frankly, the benefits of having ANY built-in regular expression system would be enormous. Developers would not have to hack together a text parser of their own to do the work that a simple regex pattern would solve. Even just distributing Lummox's library as part of a "standard library" for BYOND would be great.

Adding external libraries to our project is out of the question, as most developers would not know how to compile C++ and most external regex libraries offered here do not have compatible licensing.

Ideally, any implemented system would also be able to compile (or at least cache) expressions for later, repeated use. Look-aheads would also be of much use. Finally, some way of marking a string as a regular expression (such as python's r'' strings) would make life easier, since one wouldn't need to escape most regex structures.

You guys added MySQL and SQLite support, and Lummox was able to implement a partial Perl-like regex library entirely in BYOND. You have the talent and experience, and the tools. Please make this happen.
DM did just update to VS2013, so it's definitely feasible.

Moreover, I think the weakness really stems from strings being immutable refcounted objects.

As much as I'd kill for regex, I manage to do well enough with my own parser structures that it's not needed.

N3X15, I've stalked your git contribs. You definitely have the know-how to write a quick and dirty DLL for use with BYOND.

This kind of thing would be exactly what DLL support is good for.
I'm going to bump this again.

We at tg have an implementation using boost, but it causes problems for linux servers as the original creator didn't have the means to build an .so, so we've been hesitant to use it extensively.

Original implementation here
https://github.com/tgstation/-tg-station/pull/5871

having a regex implementation that would be in the standard library and would work reliably on all supported OS's would be nice to have

PS: if this was already done then just ignore me.

editpps: To be honest it's hard to tell if our lack of use is related to the lack of a linux library or just a lack of need, which kind of undercuts my own argument somewhat
A while back I looked into RE as a possibility; it's not as robust in its support as Boost but would be much easier to integrate. However it's been fairly low-priority. I'm definitely open to building in regex support in the future.
Lummox JR resolved issue with message:
Regular expressions are now supported with the new /regex datum and matching regex() proc.