2018-05-15 17:30:17 +02:00
/ * *
* @ author n1474335 [ n1474335 @ gmail . com ]
* @ copyright Crown Copyright 2016
* @ license Apache - 2.0
* /
2019-07-09 13:23:59 +02:00
import Operation from "../Operation.mjs" ;
import { search , URL _REGEX } from "../lib/Extract.mjs" ;
2018-05-15 17:30:17 +02:00
/ * *
* Extract URLs operation
* /
class ExtractURLs extends Operation {
/ * *
* ExtractURLs constructor
* /
constructor ( ) {
super ( ) ;
this . name = "Extract URLs" ;
this . module = "Regex" ;
this . description = "Extracts Uniform Resource Locators (URLs) from the input. The protocol (http, ftp etc.) is required otherwise there will be far too many false positives." ;
this . inputType = "string" ;
this . outputType = "string" ;
this . args = [
{
"name" : "Display total" ,
"type" : "boolean" ,
"value" : false
}
] ;
}
/ * *
* @ param { string } input
* @ param { Object [ ] } args
* @ returns { string }
* /
run ( input , args ) {
2018-11-07 14:23:05 +01:00
const displayTotal = args [ 0 ] ;
return search ( input , URL _REGEX , null , displayTotal ) ;
2018-05-15 17:30:17 +02:00
}
}
export default ExtractURLs ;