OSDN Git Service

URL自動認識を修正
authorsyo68k <syo68k@users.sourceforge.jp>
Tue, 16 Nov 2010 12:24:26 +0000 (12:24 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:16:36 +0000 (23:16 +0900)
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@1076 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/Tween.vb

index 5f7c048..861635e 100644 (file)
@@ -7499,12 +7499,16 @@ RETRY:
 
     Private Function UrlConvert(ByVal Converter_Type As UrlConverter) As Boolean
         'Converter_Type=Nicomsの場合は、nicovideoのみ短縮する
+        '参考資料 RFC3986 Uniform Resource Identifier (URI): Generic Syntax
+        'Appendix A.  Collected ABNF for URI
+        'http://www.ietf.org/rfc/rfc3986.txt
+
         Dim result As String = ""
         Const url As String = "(?<before>(?:[^\""':!=]|^|\:))" + _
                                    "(?<url>(?<protocol>https?://)" + _
                                    "(?<domain>(?:[\.-]|[^\p{P}\s])+\.[a-z]{2,}(?::[0-9]+)?)" + _
-                                   "(?<path>/[a-z0-9!*'();:&=+$/%#\[\]\-_.,~@^]*[a-z0-9)=#/]?)?" + _
-                                   "(?<query>\?[a-z0-9!*'();:&=+$/%#\[\]\-_.,~@?]*[a-z0-9_&=#/])?)"
+                                   "(?<path>/[a-z0-9!*'();:&=+$/%#\-_.,~@]*[a-z0-9)=#/]?)?" + _
+                                   "(?<query>\?[a-z0-9!*'();:&=+$/%#\-_.,~@?]*[a-z0-9_&=#/])?)"
 
         Const nico As String = "^https?://[a-z]+\.(nicovideo|niconicommons|nicolive)\.jp/[a-z]+/[a-z0-9]+$"