Community discussions

MikroTik App
 
jeroenp
Member Candidate
Member Candidate
Topic Author
Posts: 159
Joined: Mon Mar 17, 2014 11:30 am
Location: Amsterdam
Contact:

Any comments on Function.stripInvalidHostNameCharactersFromString.rsc

Mon May 09, 2016 10:26 pm

Docs:
returns $value without invalid characters for a Hostname
if $allowMultipleLabels is not nothing, then it also allows dots between labels
Execution:
/system script run stripInvalidHostNameCharactersFromString
:put [$stripInvalidHostNameCharactersFromString value=("a host name")]
ahostname
:put [$stripInvalidHostNameCharactersFromString value=("a host name.domain name" ) allowMultipleLabels="yes"]
ahostname.domainname
Any comments on the source: https://gist.github.com/jpluimers/de92c ... 83749c4c89