Note that there are some explanatory texts on larger screens.

plurals
  1. POTest if captured groups succeeded in Regular Expression in C#.NET
    primarykey
    data
    text
    <p>I'm trying to to validate video link URLs. In particular, validate share link URLs versus embed video src URLs. My current regular expression looks like this to validate two different types of video URL from vimeo.com:</p> <pre><code>^(?i)(http[s]?:\/\/)?(w{3}\.)?(?'gp1'player\.)vimeo\.com\/(?(k'gp1')video\/|())(?((\w)+\/?$ </code></pre> <p>I'm trying to use the same regex to validate the following URLs (the links below are bogus so do not click on them ):</p> <ul> <li><a href="http://www.vimeo.com/123FEDSE" rel="nofollow">http://www.vimeo.com/123FEDSE</a></li> <li><a href="http://player.vimeo.com/video/123FEDSE" rel="nofollow">http://player.vimeo.com/video/123FEDSE</a></li> </ul> <p>I can't seem to get the regex working for both cases and would like one regex to test both cases if possible.</p> <p>Thanks in Advance.</p> <p>EDIT: Thanks dtb for the post. It seems though that the regex still passes if the user passes in an invalid url: for example, if user accidentally supplied <a href="http://player.vimeo.com/123FEDSE" rel="nofollow">http://player.vimeo.com/123FEDSE</a> instead of the valid <a href="http://player.vimeo.com/video/123FEDSE" rel="nofollow">http://player.vimeo.com/video/123FEDSE</a>, it would pass the regex validation. I'm trying to use the regex to validate the URL's to ensure that it's of proper format.</p> <p>Is there a way to check if a previous capture group exists?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload