File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,17 @@ function replaceArgs(
18
18
/**
19
19
* Sindre Sorhus <https://sindresorhus.com>
20
20
* Released under MIT license
21
- * https://github.com/sindresorhus/linkify-urls/blob/edd75a64a9c36d7025f102f666ddbb6cf0afa7cd /index.js#L4C25-L4C137
21
+ * https://github.com/sindresorhus/linkify-urls/blob/b2397096df152e2f799011f7a48e5f73b4bf1c7e /index.js#L5C1-L7C1
22
22
*
23
23
* The regex is used to extract URL from the string for linkify.
24
24
*/
25
- const urlRegex =
26
- /((?<!\+) https?: \/\/(?:www\.)?(?:[-\w .]+?[.@] [a-zA-Z\d]{2,}|localhost)(?:[-\w.:%+~#*$ !?&/=@]*? (?:, (?!\s ))*? )*)/g;
25
+ const urlRegex = () =>
26
+ /((?: https?(?:: \/\/)) (?:www\.)?(?:[a-zA-Z\d-_ .]+(?:(?:\.|@) [a-zA-Z\d]{2,}) |localhost)(?:(?:[-a-zA-Z\d:%_+.~# !?&// =@]*) (?:[,] (?![\s] ))*)*)/g;
27
27
28
28
// When the message contains a URL (like https://fb.me/react-refs-must-have-owner),
29
29
// make it a clickable link.
30
30
function urlify(str: string): React.ReactNode[] {
31
- const segments = str.split(urlRegex);
31
+ const segments = str.split(urlRegex() );
32
32
33
33
return segments.map((message, i) => {
34
34
if (i % 2 === 1) {
You can’t perform that action at this time.
0 commit comments