diff --git a/templates/datatable.html b/templates/datatable.html index e0cdf11..ddf7656 100644 --- a/templates/datatable.html +++ b/templates/datatable.html @@ -25,6 +25,21 @@ "render": function ( data, type, full, meta ) { return 'Download'; } + }, + { + "targets": 0, + "render": function ( data, type, full, meta ) { + const regex = /^([^/]+)/; + const match = data.match(regex); + const prefix = match ? match[1] : ''; + const ip4regex = /\b(?:\d{1,3}\.){3}\d{1,3}(?::\d+)?\b/; + const containsIPv4 = ip4regex.test(data); + if(containsIPv4){ + return prefix + }else{ + return data + } + } } ] });