string-extra icon indicating copy to clipboard operation
string-extra copied to clipboard

regex error after importing

Open feldman4 opened this issue 7 years ago • 6 comments

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).

feldman4 avatar Oct 02 '17 05:10 feldman4

@feldman4, can you provide a reproducable example?

eeue56 avatar Oct 29 '17 22:10 eeue56

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

feldman4 avatar Oct 30 '17 02:10 feldman4

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.

Chadtech avatar Apr 11 '18 01:04 Chadtech

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

  • Firefox Developer Edition 61.0b8 (64-bit)
  • Google Chrome Version 66.0.3359.181 (Official Build) (64-bit)

jsoo1 avatar May 31 '18 03:05 jsoo1

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

jsoo1 avatar Aug 10 '18 17:08 jsoo1

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

lorenzo avatar Aug 10 '18 18:08 lorenzo