Skip to content

Instantly share code, notes, and snippets.

@aki-null
Created December 15, 2010 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aki-null/741387 to your computer and use it in GitHub Desktop.
Save aki-null/741387 to your computer and use it in GitHub Desktop.
// もしキャプチャーグループ1が空でない場合はそれをURLとする。
// そうでない場合はキャプチャーグループ0(全体)をURLとする。
(?<=[\[[\(({{⟨«‘“"'⦅⸨「「『〚⟦〔❲〘〈《⟪<<≪‹【〖])
[^\[[\(({{⟨«‘“"'⦅⸨「「『〚⟦〔❲〘〈《⟪<<≪‹【〖]*?
(https?://[^\s\]]\))}}⟩»’”"'⦆⸩」」』〛⟧〕❳〙〉》⟫>>≫›】〗]+)
(?=[\]]\))}}⟩»’”"'⦆⸩」」』〛⟧〕❳〙〉》⟫>>≫›】〗])
|https?://[^\s]+(?<![”])
@aki-null
Copy link
Author

これでは上手く処理できないケースがあるので、プログラム的にURLをスキャンするプログラムを書きました。 [https://github.com/aki-null/URLScanner]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment