JavaScript Problem: Using Dynamic Data in a Regular Expression

preview_player
Показать описание
In todays tutorial we are going to deal with a JavaScript problem that was presented by one of our Patreon viewers. We are going to look at how we can add dynamic data to a regular expression. Not a simple solution unless you know the trick.

Would you like to help keep this channel going?

Tutorials referred to in this video:

For more resources on JavaScript:

#javascript #AllThingsJavaScriptLLC #learnjavascript #javascripttutorial
Рекомендации по теме
Комментарии
Автор

This is one of those quirks present in any language where if you don't know the simple solution, something that SHOULD work, but doesn't, could waste hours of time. Thank you Steve for showing us the fix to this quirk and saving many people many, many hours of frustration!

TillmanTech
Автор

Amazing Steve. God bless you my friend.

polliluiz
Автор

great job, the best for javascript :)

abedaarabi
Автор

Any tips for parsing JSON objects via regex? Objects like:

{"NAME":"Colour", "VAL":"Red", "ID":"1"},
{"NAME":"Shape", "VAL":"Square", "ID":"2"},
{"NAME":"Size", "VAL":"500", "ID":"3"},
{"NAME":"Scale", "VAL":"2", "ID":"4"}

EDIT: Heya, I think I got it solved with my (very long) morning coffee.

Colour", "VAL":"(.*?)(", "ID)

will return the Colour.

Shape", "VAL":"(.*?)(", "ID)

Returns the shape, woo! 💪🏻

karlstenator