New answers tagged

2

Doh! It was my ternary logic that was failing not the regex. I’m now doing this: {% set vidUrl = block.videoUrl %} {% if 'youtu' in vidUrl %} {# Check for an 'embed' URL which may need cleaning #} {% set vidId = 'embed' in vidUrl ? vidUrl|replace('/^http.*embed\\/([^\\?]+)(\\?.*)?$/', '$1') : null %} {# Check for a 'watch' URL which may need ...


Top 50 recent answers are included