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(
1818/**
1919 * Sindre Sorhus <https://sindresorhus.com>
2020 * 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
2222 *
2323 * The regex is used to extract URL from the string for linkify.
2424 */
25- const urlRegex =
26- / ( (?< ! \+ ) h t t p s ? : \/ \/ (?: w w w \. ) ? (?: [ - \w . ] + ? [ . @ ] [ a - z A - Z \d ] { 2 , } | l o c a l h o s t ) (?: [ - \w . : % + ~ # * $ ! ? & / = @ ] * ? (?: , (? ! \s ) ) * ? ) * ) / g;
25+ const urlRegex = ( ) =>
26+ / ( (?: h t t p s ? (?: : \/ \/ ) ) (?: w w w \. ) ? (?: [ a - z A - Z \d - _ . ] + (?: (?: \. | @ ) [ a - z A - Z \d ] { 2 , } ) | l o c a l h o s t ) (?: (?: [ - a - z A - Z \d : % _ + . ~ # ! ? & / / = @ ] * ) (?: [ , ] (? ! [ \s ] ) ) * ) * ) / g;
2727
2828// When the message contains a URL (like https://fb.me/react-refs-must-have-owner),
2929// make it a clickable link.
3030function urlify ( str : string ) : React . ReactNode [ ] {
31- const segments = str . split ( urlRegex ) ;
31+ const segments = str . split ( urlRegex ( ) ) ;
3232
3333 return segments . map ( ( message , i ) => {
3434 if ( i % 2 === 1 ) {
You can’t perform that action at this time.
0 commit comments