You are viewing a single comment's thread from:

RE: View your favourite content on the SteemMakers website

in #utopian-io8 years ago

Thank you for the attentive reading. You are correct. I only told half the story, basically venting regex frustration. Once they work they are so very usefull but they can be so tricky to get right.

The bigger picture is that the code first searches for youtube urls and extracts the video id to then make it's own url out of this for consistent representation. That one is a bit more complex:

let videoID = link.match(/(?:(?:youtube.com\/watch\?v=)|(?:youtu.be\/)|(?:youtube.com\/embed\/))([A-Za-z0-9\_\-]+)/i);

I chose to stay as close as possible to the logic condenser uses because that is still the main interface and since articles can't be written on our site we need to display content in a similar way to condenser. Busy follows the same idea, they also mimic the condenser code and explicitly refer to it (as do we)

Coin Marketplace

STEEM 0.08
TRX 0.29
JST 0.035
BTC 103492.17
ETH 3424.81
USDT 1.00
SBD 0.52