RegEx expression not valid on CodePen

RegEx expression not valid on CodePen
0

#1

I’m using a RegEx expression in my code that CodePen deems to be invalid (even though it actually works): /(?<=:)\d+/

Does anyone know a way around this?

The codepen in which I’m using it is here (line 114):

Thank you!


#2

I don’t know why your regex is failing (not a regex guru), but you might try /\d+$/ just capturing the number from the end of the string.

Also, there are problems in your codepen. In codepen, you don’t load all those things in the HTML. You’re HTML should only be the things between the body tags, not including the body tags. Everything else is handled by codepen or loaded by you in the codepen setup. For example, your line

<link rel="stylesheet" href="pomodoro2.css" />

is throwing an error in your console because codepen has no idea where that file is:

GET https://codepen.io/boomerang/iFrameKey-48102e06-bd9a-d5c7-f176-2531d8a950b3/pomodoro2.css net::ERR_ABORTED

Codepen can’t load local files.


#3

Thank you so much! That regex expression is definitely way simpler and equally does the job!

Yeah, I forgot to remove those things. I edited the files in Brackets originally. Thanks again :slight_smile: