Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Uncaught SyntaxError: Invalid regular expression #42

Closed
athomann opened this issue Feb 23, 2016 · 10 comments
Closed

Uncaught SyntaxError: Invalid regular expression #42

athomann opened this issue Feb 23, 2016 · 10 comments

Comments

@athomann
Copy link
Contributor

I hooked up the Tweet example into my app and receive this warning. The error seems to disable console.logs on the client side.
screen shot 2016-02-23 at 10 39 43 am

@hellendag
Copy link

This is just using the same regex as in tweet.html?

@athomann
Copy link
Contributor Author

After a little bit more testing, it appears I get the error by simply adding in an import statement into a component.
import {Editor, EditorState} from 'draft-js';

@athomann
Copy link
Contributor Author

screen shot 2016-02-24 at 9 47 13 pm

@athomann athomann reopened this Feb 25, 2016
@jamesbrewerdev
Copy link

This just happened to me as well. It also happens with the following using Webpack:

const Editor = require('draft-js').Editor;
const EditorState = require('draft-js').EditorState

@jamesbrewerdev
Copy link

Figured it out. draft-js requires fbjs, which is responsible for the error. The error occurs because the browser doesn't recognize the UTF-8 characters in the regex posted above.

Solution:

Include <meta charset="utf-8" /> in the <head></head> block of your HTML file!

@athomann
Copy link
Contributor Author

That did it! Thanks @BRWR. I thought I had that in there..

@hellendag
Copy link

Nice catch, thanks all.

@jgzak
Copy link

jgzak commented Jul 18, 2017

if I deploy the same app on https server the issue appears again. (There is no issue if bundle served from http server)

@xyzdata
Copy link

xyzdata commented Sep 5, 2017

I also got this problem when I using Apache Server to run react app!

main.fd8154e8.js:1 Uncaught SyntaxError: Invalid regular expression: /[A-Za-zªµºÀ-ÖØ-öø-ƺƻƼ-ƿǀ-ǃDŽ-ʓʔʕ-ʯʰ-ʸʻ-��-ˑˠ-ˤˮͰ-ͳͶ-ͷͺͻ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-�҂Ҋ-ԯԱ-Ֆՙ՚-՟ա-և։ःऄ-हऻऽा-ीॉ-ौॎ-��क़-ॡ।-॥०-९॰ॱॲ-ঀং-ঃঅ-ঌ�-�ও-নপ-রলশ-হঽা-ীে-ৈো-ৌৎৗড়-�য়-ৡ০-৯ৰ-ৱ৴-৹৺ਃਅ-ਊ�-�ਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਾ-ੀਖ਼-ੜਫ਼੦-੯ੲ-ੴઃઅ-��-ઑઓ-નપ-રલ-ળવ-હઽા-ીૉો-ૌ�ૠ-ૡ૦-૯૰ଂ-ଃଅ-ଌ�-�ଓ-ନପ-ରଲ-ଳଵ-ହଽାୀେ-ୈୋ-ୌୗଡ଼-�ୟ-ୡ୦-୯୰ୱ୲-୷ஃஅ-ஊஎ-�ஒ-கங-சஜஞ-டண-தந-பம-ஹா-ி�-ூெ-ைொ-ௌ�ௗ௦-௯௰-௲�-ఃఅ-ఌఎ-�ఒ-నప-హఽ�-ౄౘ-ౙౠ-ౡ౦-౯౿ಂ-ಃಅ-ಌಎ-�ಒ-ನಪ-ಳವ-ಹಽಾಿೀ-ೄೆೇ-ೈೊ-ೋೕ-ೖೞೠ-ೡ೦-೯ೱ-ೲം-ഃഅ-ഌഎ-�ഒ-ഺഽാ-ീെ-ൈൊ-ൌൎൗൠ-ൡ൦-൯൰-൵൹ൺ-ൿං-ඃඅ-ඖක-නඳ-රලව-ෆ�-ෑෘ-ෟ෦-෯ෲ-ෳ෴�-ะา-ำเ-ๅๆ��-๙๚-๛�-ຂຄງ-ຈຊ�ດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆ�-໙ໜ-ໟༀ�-༃༄-༒༓༔༕-༗༚-༟༠-༩༪-༳༴༶༸༾-༿ཀ-ཇཉ-ཬཿ྅ྈ-ྌ྾-࿅࿇-࿌࿎-��-࿔࿕-࿘࿙-࿚က-ဪါ-ာေးျ-ြဿ�-��-��-��-��-���-��-��-��-��-�ႃ-ႄႇ-ႌႎ��-႙ႚ-ႜ႞-႟Ⴀ-ჅჇ��-ჺ჻ჼჽ-ቈቊ-��-ቖቘቚ-�በ-ኈኊ-��-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-�ጒ-ጕጘ-��-��-�ᎀ-�Ꭰ-��-ᙬ᙭-᙮ᙯ-ᙿ�-ᚚᚠ-ᛪ᛫-᛭ᛮ-ᛰᛱ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱ᜵-᜶�-��-��-�ក-ឳាើ-ៅះ-ៈ។-៖ៗ៘-៚ៜ០-៩�-᠙ᠠ-ᡂᡃᡄ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᤣ-ᤦᤩ-ᤫᤰ-ᤱᤳ-ᤸ᥆-��-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧀ�-ᧇᧈ-ᧉ�-᧙᧚ᨀ-ᨖᨙ-ᨚ᨞-᨟ᨠ-ᩔᩕᩗᩡᩣ-ᩤᩭ-ᩲ᪀-᪉�-᪙᪠-᪦ᪧ᪨-᪭ᬄᬅ-ᬳᬵᬻᬽ-�ᭃ-᭄ᭅ-ᭋ�-᭙᭚-᭠᭡-᭪᭴-᭼ᮂᮃ-ᮠᮡᮦ-ᮧ᮪ᮮ-ᮯ᮰-᮹ᮺ-ᯥᯧᯪ-ᯬᯮ᯲-᯳᯼-᯿ᰀ-ᰣᰤ-ᰫᰴ-ᰵ᰻-᰿᱀-᱉�-��-᱙ᱚ-ᱷᱸ-ᱽ᱾-᱿᳀-᳇᳓᳡ᳩ-ᳬᳮ-ᳱᳲ-ᳳᳵ-ᳶᴀ-ᴫᴬ-ᵪᵫ-ᵷᵸᵹ-ᶚᶛ-ᶿḀ-ἕἘ-�ἠ-ὅὈ-��-ὗὙὛ�Ὗ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌ�-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‎���-ₜℂℇℊ-ℓℕℙ-�ℤΩℨK-ℭℯ-ℴℵ-ℸℹℼ-ℿⅅ-ⅉⅎ�Ⅰ-ↂↃ-ↄↅ-ↈ⌶-�⎕⒜-ⓩ⚬⠀-⣿Ⰰ-Ⱞⰰ-ⱞⱠ-ⱻⱼ-ⱽⱾ-ⳤⳫ-ⳮⳲ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵰ⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎ�-ⷖⷘ-ⷞ々〆〇〡-〩〮-〯〱-〵〸-〺〻〼�-ゖ�-ゞゟァ-ヺー-ヾヿㄅ-ㄭㄱ-ㆎ�-㆑㆒-㆕㆖-㆟ㆠ-ㆺㇰ-ㇿ㈀-㈜㈠-㈩㈪-㉇㉈-�㉠-㉻㉿㊀-㊉㊊-㊰㋀-㋋�-㋾㌀-��-��-��-䶵一-鿌ꀀ-ꀔꀕꀖ-ꒌ�-ꓷꓸ-ꓽ꓾-꓿ꔀ-ꘋꘌ�-ꘟ꘠-꘩ꘪ-ꘫꙀ-ꙭꙮꚀ-ꚛꚜ-�ꚠ-ꛥꛦ-ꛯ꛲-꛷Ꜣ-���-ꞇ꞉-꞊Ꞌ-ꞎ�-ꞭꞰ-Ʇꟷꟸ-ꟹꟺꟻ-�ꠃ-ꠅꠇ-ꠊꠌ-ꠢꠣ-ꠤꠧ꠰-꠵꠶-꠷ꡀ-ꡳꢀ-�ꢂ-ꢳꢴ-ꣃ꣎-��-꣙ꣲ-ꣷ꣸-꣺ꣻ꤀-꤉ꤊ-ꤥ꤮-꤯ꤰ-ꥆꥒ-꥓꥟ꥠ-ꥼꦃꦄ-ꦲꦴ-ꦵꦺ-ꦻꦽ-꧀�-���-꧙꧞-꧟ꧠ-ꧤꧦꧧ-ꧯ꧰-꧹ꧺ-ꧾꨀ-ꨨꨯ-ꨰꨳ-ꨴꩀ-ꩂꩄ-ꩋ��-꩙꩜-꩟ꩠ-ꩯꩰꩱ-ꩶ꩷-꩹ꩺꩻꩽꩾ-ꪯꪱꪵ-ꪶꪹ-ꪽꫀꫂꫛ-ꫜ�꫞-꫟ꫠ-ꫪꫫꫮ-ꫯ꫰-꫱ꫲꫳ-ꫴꫵ�-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚ꭛ꭜ-ꭟꭤ-ꭥꯀ-ꯢꯣ-ꯤꯦ-ꯧꯩ-ꯪ꯫꯬꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ-豈-舘並-龎ff-stﬓ-ﬗA-Z�-zヲ-ッーア-�゙-゚ᅠ-하-ᅦᅧ-�ᅭ-ᅲᅳ-ᅵ�־׀׃׆׈-��-ת׫-ׯװ-ײ׳-״׵-׿߀-߉ߊ-ߪߴ-ߵߺ߻-߿ࠀ-ࠕࠚࠤࠨ࠮-࠯࠰-࠾࠿ࡀ-ࡘ࡜-�࡞࡟-࢟��ײַ-ﬨשׁ-זּ﬷טּ-לּ﬽מּ﬿נּ-�﭂ףּ-פּ﭅צּ-�؈؋�؛؜�؞-؟ؠ-ؿـ�-ي٭ٮ-ٯٱ-ۓ۔ەۥ-ۦۮ-ۯۺ-ۼ۽-۾ۿ܀-�܎��ܒ-ܯ݋-݌�-ޥޱ޲-޿ࢠ-ࢲࢳ-ࣣ�-ﮱ﮲-�﯂-﯒ﯓ-ﴽ﵀-��-��-﶑ﶒ-ﷇ﷈-�ﷰ-ﷻ﷼﷾-﷿ﹰ-ﹴ﹵ﹶ-ﻼ﻽-﻾]/: Range out of order in character class
    at RegExp (<anonymous>)
    at Object.<anonymous> (main.fd8154e8.js:1)
    at t (main.fd8154e8.js:1)
    at Object.<anonymous> (main.fd8154e8.js:1)
    at t (main.fd8154e8.js:1)
    at Object.<anonymous> (main.fd8154e8.js:1)
    at t (main.fd8154e8.js:1)
    at Object.<anonymous> (main.fd8154e8.js:1)
    at t (main.fd8154e8.js:1)
    at Object.<anonymous> (main.fd8154e8.js:1)

solution

just need to set encoding UTF-8! @BRWR, thanks a lot!

<meta charset="UTF-8">

<!DOCTYPE html>
<meta charset="UTF-8">
<html lang="zh-Hans">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link rel="manifest" href="./manifest.json">
    <link rel="shortcut icon" href=",/favicon.ico">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <title>React App</title>
    <link href="./static/css/main.e8e29e73.css" rel="stylesheet">
</head>

<body><noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script type="text/javascript" src="./static/js/main.fd8154e8.js"></script>
</body>

</html>

@Rajendra24
Copy link

Thanks.
This is working for me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants