I got it working with a cursor
Local RegEx As VBScript.RegExp
m.RegEx = Createobject("VBScript.RegExp")
m.RegEx.Ignorecase = .F.
m.RegEx.Multiline = .F.
m.RegEx.Global = .T.
m.RegEx.Pattern ="(\/watch\?v\=|\/\w+\?v=|\/|v=)([a-zA-Z0-9\-]+)($|\?|\&)"
Local xURL As String
Create Cursor YCURS (url c(100),videoID c(20))
Set Memowidth To 8192
TEXT TO m.Source NOSHOW
http://youtu.be/NLqAF9hrVbY
http://www.youtube.com/embed/NLqAF9hrVbY
https://www.youtube.com/embed/NLqAF9hrVbY
http://www.youtube.com/v/NLqAF9hrVbY?fs=1&hl=en_US
http://www.youtube.com/watch?v=NLqAF9hrVbY
http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo
http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I
http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/2/PPS-8DMrAn4
http://gdata.youtube.com/feeds/api/videos/NLqAF9hrVbY
http://www.youtube.com/watch?v=spDj54kf-vY&feature=g-vrec
http://www.youtube.com/watch?v=GUEZCxBcM78&feature=pyv&feature=pyv&ad=10059374899&kw=%2Bwingsuit
ENDTEXT
For i=1 To Memlines(m.source)
Insert Into YCURS Values(Mline(m.source,i),"")
Endfor
Local SampleIndex
Scan
xURL=Allt(url)
m.Matches = m.RegEx.Execute(m.xURL)
Repl videoID With (m.Matches.Item(0).SubMatches(1))
Endscan
Brow
Retu
notes:curious Regexp object
1.code works with a specifc regEXP.pattern (for first not for second).
2.for cursor regEXP.execute must receive a string instead a field as url
it return matches.count=0 for a field url and matches.count=1 for a strind (xURL=url)