Go Back   Freethought Forum > Public Works > Forum Administration

Reply
 
Thread Tools Display Modes
  #26  
Old 08-26-2016, 01:34 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

The https matching works

But I'm still getting 'An error occurred. Please try again later.' as with my post above
Quote:
Originally Posted by JoeP View Post
...
At least at the moment for me this thinks for a while and then errors out.
Attachment 10295
... cept?

Might be some blocking settings in my browser. Will test.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #27  
Old 08-26-2016, 01:36 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

YouTube
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #28  
Old 08-26-2016, 01:37 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #29  
Old 08-26-2016, 01:37 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

PyQt4 Model View Tutorial Part 01_0 - YouTube
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #30  
Old 08-26-2016, 01:38 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

The youtu.be short URL format isn't working because I made some dumb assumptions about the url format ... :plzhold:
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #31  
Old 08-27-2016, 02:54 AM
viscousmemories's Avatar
viscousmemories viscousmemories is offline
Admin
 
Join Date: Apr 2004
Location: Ypsilanti, Mi
Gender: Male
Posts: XXXDCCXLVI
Blog Entries: 1
Images: 9
Default Re: What's with the Youtubes

Oh, sorry. I didn't use the full regex that you said could use some testing, I just added the 'https' to what was already there.
Reply With Quote
  #32  
Old 08-27-2016, 10:31 AM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Smrt - the fuller regex is def wrong :)
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #33  
Old 08-29-2016, 03:38 AM
erimir's Avatar
erimir erimir is offline
Projecting my phallogos with long, hard diction
 
Join Date: Sep 2005
Location: Dee Cee
Gender: Male
Posts: XMMMDCCCVI
Images: 11
Default Re: What's with the Youtubes

Is there some reason I keep seeing this:
Code:
[http://]*[https://]*
instead of this?

Code:
[https?://]*
(Excuse me if that syntax is wrong, I mostly only do regex in Python.)
Reply With Quote
Thanks, from:
ceptimus (08-29-2016), JoeP (08-29-2016)
  #34  
Old 08-29-2016, 11:45 AM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Reason 1: I was entirely lazy when I wrote it.
Reason 2: I haven't thought through it very carefully since.
Reason 3: I certainly haven't tested it.

Looking at it afresh, it strikes me that the [] notation isn't a group it's a character set / character class. So
Code:
[http://]*
would in fact match any of the following strings
'http://'
''
'ptp'
'pthhhpt'
'h://tpp:hhhh/p:t'
which is not really what is wanted.

* JoeP thinks further
Code:
(?:https?://)?
may be better.

* JoeP strolls over to regex test pages.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
Pan Narrans (08-29-2016)
  #35  
Old 08-29-2016, 11:52 AM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Quick, I need 100 test YouTube urls
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #36  
Old 08-29-2016, 12:35 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Test.

pttthhpt:::thisisinvalid.youtube.mars/watch?v=2qbmGDuzPU8
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #37  
Old 08-29-2016, 12:36 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

pttthhpt:::
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #38  
Old 08-29-2016, 12:36 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

thisisinvalid.youtube.mars/watch?v=2qbmGDuzPU8
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #39  
Old 08-29-2016, 12:37 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

www.youtube.mars/watch?v=2qbmGDuzPU8
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #40  
Old 08-29-2016, 12:38 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

That regex is not the complete story. Perhaps the vB mod is only checking strings already identified as urls by vb.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #41  
Old 08-29-2016, 12:40 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

http://www.youtube.com/watch?v=2qbmGDuzPU8
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #42  
Old 08-29-2016, 12:41 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Yup,
Automatically embed media (requires automatic parsing of links in text to be on).
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #43  
Old 08-29-2016, 12:42 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

pttthhpt:::thisisinvalid.youtube.mars/watch?v=2qbmGDuzPU8
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #44  
Old 08-29-2016, 12:44 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Yup, the [ ] isn't what whoever wrote that original regex thought it was
hh//tt::pp//tt:/:/thisisinvalid.youtube.mars/watch?v=BokeCYFdLFw
Code:
hh//tt::pp//tt:/:/thisisinvalid.youtube.mars/watch?v=BokeCYFdLFw
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
  #45  
Old 08-29-2016, 12:46 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

This is solid:
Code:
(?:https?://)?(?:www.)?(?:youtube.com/watch?v=|youtu.be/)([A-Z0-9._%-]*)[&w;=+_-]*
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
ceptimus (08-29-2016), viscousmemories (08-30-2016)
  #46  
Old 08-29-2016, 12:47 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Videos courtesy of Random YouTube Videos.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
ceptimus (08-29-2016)
  #47  
Old 08-29-2016, 12:48 PM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Regex testing courtesy of Online regex tester and debugger: JavaScript, Python, PHP, and PCRE which is awesome because it describes your regex:

/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu.be\/)([A-Z0-9._%-]*)[&w;=+_-]*/gi

(?:https?:\/\/)? Non-capturing group
Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
http matches the characters http literally (case insensitive)
s? matches the character s literally (case insensitive)
Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
: matches the character : literally
\/ matches the character / literally
\/ matches the character / literally
(?:www\.)? Non-capturing group
Quantifier: ? Between zero and one time, as many times as possible, giving back as needed [greedy]
www matches the characters www literally (case insensitive)
\. matches the character . literally
(?:youtube\.com\/watch\?v=|youtu.be\/) Non-capturing group
1st Alternative: youtube\.com\/watch\?v=
youtube matches the characters youtube literally (case insensitive)
\. matches the character . literally
com matches the characters com literally (case insensitive)
\/ matches the character / literally
watch matches the characters watch literally (case insensitive)
\? matches the character ? literally
v= matches the characters v= literally (case insensitive)
2nd Alternative: youtu.be\/
youtu matches the characters youtu literally (case insensitive)
. matches any character (except newline)
be matches the characters be literally (case insensitive)
\/ matches the character / literally
1st Capturing group ([A-Z0-9._%-]*)
[A-Z0-9._%-]* match a single character present in the list below
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
A-Z a single character in the range between A and Z (case insensitive)
0-9 a single character in the range between 0 and 9
._%- a single character in the list ._%- literally
[&w;=+_-]* match a single character present in the list below
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
&w;=+_- a single character in the list &w;=+_- literally (case insensitive)
g modifier: global. All matches (don't return on first match)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
ceptimus (08-29-2016), Kyuss Apollo (08-30-2016), Pan Narrans (08-30-2016), The Man (08-30-2016), viscousmemories (08-30-2016)
  #48  
Old 08-30-2016, 04:30 AM
viscousmemories's Avatar
viscousmemories viscousmemories is offline
Admin
 
Join Date: Apr 2004
Location: Ypsilanti, Mi
Gender: Male
Posts: XXXDCCXLVI
Blog Entries: 1
Images: 9
Default Re: What's with the Youtubes

Applied!
Reply With Quote
Thanks, from:
JoeP (08-30-2016), Kyuss Apollo (08-30-2016)
  #49  
Old 08-30-2016, 10:32 AM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Testis.

__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
viscousmemories (08-31-2016)
  #50  
Old 08-30-2016, 10:32 AM
JoeP's Avatar
JoeP JoeP is online now
Solipsist
 
Join Date: Jul 2004
Location: Kolmannessa kerroksessa
Gender: Male
Posts: XXXVMMX
Images: 18
Default Re: What's with the Youtubes

Succestis!
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:   :finland:
Reply With Quote
Thanks, from:
viscousmemories (08-31-2016)
Reply

  Freethought Forum > Public Works > Forum Administration


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

 

All times are GMT +1. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Page generated in 0.56151 seconds with 15 queries