Commit 17e9894 1 parent 9cb26c7 commit 17e9894 Copy full SHA for 17e9894
File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -251,9 +251,13 @@ hahev11@walla.com
251
251
252
252
רוצה לדעת לפני כולם מה קורה?
253
253
להצטרפות לקבוצות של מה קורה היום? >> makorehayom.info/48YR0Sw` ,
254
- [ "http://shiri -livny.com/adamaretreat" , "http:// makorehayom.info/48YR0Sw" ] ,
254
+ [ "Shiri -livny.com/adamaretreat" , "makorehayom.info/48YR0Sw" ] ,
255
255
] ,
256
256
[ "" , [ ] ] ,
257
+ [
258
+ "https://gigtickets.co.il/il//eid/101" ,
259
+ [ "https://gigtickets.co.il/il//eid/101" ] ,
260
+ ] ,
257
261
] ) ;
258
262
259
263
testUnaryFn ( "telegram handlers" , telegramHandlesInText ) ( [
Original file line number Diff line number Diff line change @@ -393,9 +393,24 @@ const removeEmails = replace(
393
393
"" ,
394
394
) ;
395
395
396
+ const extractUrls = ( text : string ) => {
397
+ const urlRegex =
398
+ / (?: (?: h t t p s ? | f t p ) : \/ \/ ) ? [ \w . - ] + (?: \. [ \w . - ] + ) + [ \w \- . _ ~ : / ? # [ \] @ ! $ & ' ( ) * + , ; = ] * / g;
399
+ const urls = text . match ( urlRegex ) || [ ] ;
400
+ // Filter out things that look like version numbers or other unwanted patterns
401
+ const filteredUrls = urls . filter ( ( url ) => {
402
+ // Basic filter to exclude things that look like version numbers or paths beginning with numbers.
403
+ if ( / ^ \d + \. \d + / . test ( url ) || / ^ \d + \/ \/ / . test ( url ) ) {
404
+ return false ;
405
+ }
406
+ return true ;
407
+ } ) ;
408
+ return filteredUrls ;
409
+ } ;
410
+
396
411
export const urlsInText = (
397
412
x : string ,
398
- ) => [ ... getUrls ( removeEmails ( x ) . replace ( / \b [ ^ \s ] + .( j p g | p n g | j p e g ) \b / g, "" ) ) ] ;
413
+ ) => extractUrls ( removeEmails ( x ) . replace ( / \b [ ^ \s ] + .( j p g | p n g | j p e g ) \b / g, "" ) ) ;
399
414
400
415
type Keywords = { keywords : string [ ] ; antiKeywords ?: string [ ] } ;
401
416
You can’t perform that action at this time.
0 commit comments