elm-community / string-extra

String helper functions for Elm.
http://package.elm-lang.org/packages/elm-community/string-extra/latest
BSD 3-Clause "New" or "Revised" License
34 stars 26 forks source link

regex error after importing #22

Open feldman4 opened 7 years ago

feldman4 commented 7 years ago

Importing version 1.4.0 and compiling gives the following error

App.js:8623 Uncaught SyntaxError: Invalid regular expression: /[Ù-Ü]/: Range out of order in character class
    at new RegExp (<anonymous>)
    at regex (App.js:8623)
   ...

in a code block that begins

var _elm_community$string_extra$String_Extra$accentRegex = function () {
... 
}

using Google Chrome | 61.0.3163.100 (Official Build) (64-bit).

eeue56 commented 7 years ago

@feldman4, can you provide a reproducable example?

feldman4 commented 7 years ago

Not sure how to make this a minimal example, but the following reproduces the error. Deleting import String.Extra in src/App.elm removes the error.

git clone https://github.com/feldman4/elm-davis.git .
elm-make src/App.elm --output=scripts/App.js
open index.html
Chadtech commented 6 years ago

Im also experiencing this. Same function.

    var _elm_community$string_extra$String_Extra$accentRegex = function() {
        var matches = {
            ctor: '::',
            _0: {
                ctor: '_Tuple2',
                _0: '[à-æ]',
                _1: 'a'
            },
            _1: {
                ctor: '::',
                _0: {
                    ctor: '_Tuple2',
                    _0: '[À-Æ]',
                    _1: 'A'
                },
                _1: {
                    ctor: '::',
                    _0: {
                        ctor: '_Tuple2',
                        _0: 'ç',
                        _1: 'c'
                    },
                    _1: {
                        ctor: '::',
                        _0: {
                            ctor: '_Tuple2',
                            _0: 'Ç',
                            _1: 'C'
                        },
                        _1: {
                            ctor: '::',
                            _0: {
                                ctor: '_Tuple2',
                                _0: '[è-ë]',
                                _1: 'e'
                            },
                            _1: {
                                ctor: '::',
                                _0: {
                                    ctor: '_Tuple2',
                                    _0: '[È-Ë]',
                                    _1: 'E'
                                },
                                _1: {
                                    ctor: '::',
                                    _0: {
                                        ctor: '_Tuple2',
                                        _0: '[ì-ï]',
                                        _1: 'i'
                                    },
                                    _1: {
                                        ctor: '::',
                                        _0: {
                                            ctor: '_Tuple2',
                                            _0: '[Ì-Ï]',
                                            _1: 'I'
                                        },
                                        _1: {
                                            ctor: '::',
                                            _0: {
                                                ctor: '_Tuple2',
                                                _0: 'ñ',
                                                _1: 'n'
                                            },
                                            _1: {
                                                ctor: '::',
                                                _0: {
                                                    ctor: '_Tuple2',
                                                    _0: 'Ñ',
                                                    _1: 'N'
                                                },
                                                _1: {
                                                    ctor: '::',
                                                    _0: {
                                                        ctor: '_Tuple2',
                                                        _0: '[ò-ö]',
                                                        _1: 'o'
                                                    },
                                                    _1: {
                                                        ctor: '::',
                                                        _0: {
                                                            ctor: '_Tuple2',
                                                            _0: '[Ò-Ö]',
                                                            _1: 'O'
                                                        },
                                                        _1: {
                                                            ctor: '::',
                                                            _0: {
                                                                ctor: '_Tuple2',
                                                                _0: '[ù-ü]',
                                                                _1: 'u'
                                                            },
                                                            _1: {
                                                                ctor: '::',
                                                                _0: {
                                                                    ctor: '_Tuple2',
                                                                    _0: '[Ù-Ü]',
                                                                    _1: 'U'
                                                                },
                                                                _1: {
                                                                    ctor: '::',
                                                                    _0: {
                                                                        ctor: '_Tuple2',
                                                                        _0: 'ý',
                                                                        _1: 'y'
                                                                    },
                                                                    _1: {
                                                                        ctor: '::',
                                                                        _0: {
                                                                            ctor: '_Tuple2',
                                                                            _0: 'ÿ',
                                                                            _1: 'y'
                                                                        },
                                                                        _1: {
                                                                            ctor: '::',
                                                                            _0: {
                                                                                ctor: '_Tuple2',
                                                                                _0: 'Ý',
                                                                                _1: 'Y'
                                                                            },
                                                                            _1: {
                                                                                ctor: '[]'
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        };
        return A2(_elm_lang$core$List$map, function(_p0) {
            var _p1 = _p0;
            return {
                ctor: '_Tuple2',
                _0: _elm_lang$core$Regex$regex(_p1._0),
                _1: _p1._1
            };
        }, matches);
    }();

I'm not sure why this is a problem for me. When I build and run my code locally it works fine. When I deploy to surge.sh it also works fine. When I deploy to AWS however, it does not. It doesnt make sense to me why my deploy target matters, so I presume I dont understand my circumstance, but right now thats what the difference appears to be.

jsoo1 commented 6 years ago

I just experienced this, too (same error, same line). I discovered it locally on version 1.4.0. Both in firefox and Chrome:

jsoo1 commented 6 years ago

Is this a locale issue? If so, how can it be fixed? I want to use this package but this is blocking me.

lorenzo commented 6 years ago

No idea to be honest. It would be nice to first know how to reproduce it.