purescript-strings icon indicating copy to clipboard operation
purescript-strings copied to clipboard

Add support for dotAll flag?

Open chtenb opened this issue 4 years ago • 5 comments

The dotAll flag doesn't seem to be exposed in the Regex module. Could we add it?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll

chtenb avatar Jun 04 '21 11:06 chtenb

Just a question. Is the dotall flag a JS-specific feature? If so, I'm guessing it can't be supported in other backends.

JordanMartinez avatar Dec 01 '21 03:12 JordanMartinez

I'm only familiar with the JS backend. Which other backends do I need to check?

chtenb avatar Dec 01 '21 08:12 chtenb

I'd never given much thought to regex compat across backends before, it's a pretty tricky issue! Even without considering options the meaning of a regex could differ between backends.

I was almost going to suggest regex should be split into its own js-regex library or something, but then this whole String library is generally very JS centric, given ucs-2, codepoint vs char, etc. 🤔

garyb avatar Dec 01 '21 14:12 garyb

I wasn't aware those packages were also used when targetting other languages. TIL :) If we want to transparently expose the native regex implementation of each language there's bound to be differences indeed. Making a separate string library for each backend makes sense, but that also makes purescript generally less portable. If we want to abstract over string implementations and string manipulation libraries to create an opaque PureScript string library, then that may be harder to implement for each backend. I'm also not sure if that would have too much impact on string performance.

chtenb avatar Dec 01 '21 15:12 chtenb