Skip to content

Instantly share code, notes, and snippets.

@kjunichi
Last active August 29, 2015 13:55
Show Gist options
  • Save kjunichi/8723031 to your computer and use it in GitHub Desktop.
Save kjunichi/8723031 to your computer and use it in GitHub Desktop.
むかしはPerlで少しこの辺りを勉強しようとはしていたのだが、、、

JavaScriptでの正規表現の扱い

キャプチャ関連

$1,$2

マッチの前

残りの要素は

改行を含む文字列中からURLを取り出すには

data = data.replace(/(https?)\:\/\/(.*?)\//g,myUrlPrefix + "?x_inside_proto=$1&x_inside_host=$2&x_inside_path=/");

関連Gist

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