Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6147269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:04:52+00:00 2026-05-23T19:04:52+00:00

I know first off that this is probably the worst looking regex ever but

  • 0

I know first off that this is probably the worst looking regex ever but here goes.

I have this regex

(?:http://)?(?:www.)?youtu(?:be)?.(?:[a-z]){2,3}(?:[a-z/?=]+)([a-zA-Z0-9-_]{11})(?:[a-z0-9?&-_=]+)?

which is capable of matching any of these

www.youtu.be/watch?v=QH2-TGUlwu4
http://www.youtube.com/watch?v=QH2-TGUlwu4&feature=related
http://youtu.be/QH2-TGUlwu4
https://youtube.com/watch?v=QH2-TGUlwu4
https://youtube.com/watch?v=QH2-TGUlwu4%3Fversion%3D3%26amp%3Bhl%3Den_US

What it does in javascript is tears it apart and just returns the video code.

What I would like to happen is for it to return zero matches if the whole string starts with a double or single quote like so.

“http://youtu.be/QH2-TGUlwu4

Here is where I lose all sense of what I am doing. I know what a negative lookahead is in theory but I found this somewhere else on the site and just plugged it in thinking it would solve problems.

If i put this ^(?!\") before it, it will return zero matches if anything is before the string.

Help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:04:53+00:00Added an answer on May 23, 2026 at 7:04 pm

    Get rid of the ^. It’s constraining the match to the beginning of the string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, yes I know about this question , but I'm looking for a bit
First off I know this has been covered on SO. But the most popular
First off I'm not sure that's the proper title for this question but hopefully
problem euler #5 i found the solution but i don't know why this first
First of all, I know how to build a Java application. But I have
First off, it may seem that I'm asking for subjective opinions, but that's not
First off, I know this may be a very stupid question, so don't shoot
First off, The Problem: We have a Web App with a Flash front-end that
First off: I know that AES is a block cipher and not a hashing
Let me start off by saying that this is my first real Cocoa app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.