質問編集履歴
1
文字修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
```JavaScript
|
11
11
|
var text = '<p>あいうえおかきくけこhttp://google.com</p>';
|
12
12
|
text = text.replace(/(http(s)?://[\x21-\x7e]+)/gi, "<a href='$1' target='_blank'>$1</a>");
|
13
|
-
console.log(
|
13
|
+
console.log(text);
|
14
14
|
|
15
15
|
// 実行結果(p閉じタグを巻き込んでしまっている)
|
16
16
|
// <p>あいうえおかきくけこ<a href='http://google.com</p>' target='_blank'>http://google.com</p></a>
|