Use case: portable multi-platform kdbx sync and remote file operations within opened database (like from removable media and/or encrypted container). Specifically, before sync with remote kdbx, check for host availability has no appropriate syntax to extract host name/ip from URL field.
Problem desc: UNC path like \server\path\file or FTP access like ftp://server/file in URL address field give no documented option for extracting host name or IP (like {BASE:HOST}) to check its availability in Host reachable trigger condition. Moreover the check passes when the host string left blank, which is bad default when placeholder uses string manipulation routines like regex internally.
The easiest way would be adding extra Type specification that would include {URL:HOST} functionality applied for Text in {T-CONV:/Text/Type/}.
Another way would be {REF:A@I:xxxx} extended to placed into trigger condition field as host. Like {REF:A:HOST@I:xxxx} or {REF:A@I:xxxx:HOST} or {{REF:A@I:xxxx}:HOST} syntax.
Third way that unfortunately also failed is using regex placeholder like this:
{T-REPLACE-RX:/{REF:A@I:xxxx}/(?:.+:\/\/)([\--z][^\/]+)(?:.*)/$1/}
That regex above wrongly returns empty string instead of the host (tested with ftp://host/file like URL string).
EDIT: The fourth and possibly easiest way would be that KP Is host reachable function would perform host extraction from given URL internally.
Last edit: Anonymous 2017-01-27
Your regular expression contains '
/' characters, thus you cannot use '/' as separator character for the T-REPLACE-RX placeholder. You could for instance use '!' instead (like in the documentation).Anyway, some easier solution would be good, thus I'm moving this to the open feature requests.
Thanks and best regards,
Dominik
Ticket moved from /p/keepass/bugs/1607/
Dominik, not so fast!
As per original post, currently the only possible solution would be the third one. Unfortunately that doesn't work for the reasons outlined below.
Even if you replace the separator, there are exactly two BUGS left:
It returns whole {REF:A@I:xxxUUIDxxx} unchanged, i.e. the entire field
ftp://server/fileinstead of justserver. I've checked regex hereMaybe you'd want to split those into 2 separate issues.
Last edit: Anonymous 2017-02-04
This behavior is intended. An empty string basically means localhost, which is always reachable.
The regular expression testing website that you mentioned only supports JavaScript and PCRE engines. My suggestion would be to use a testing website that supports the .NET regular expression engine, e.g. http://regexstorm.net/tester .
Apparently, '
\-' has a special meaning. You could replace it by ',' or 'a'. For example, the following works fine:(?:.+:\/\/)([a-z][^\/]+)(?:.*)Best regards,
Dominik
Last edit: Dominik Reichl 2017-02-04
ping ''orping ""and see Name or service not known (ping command response shown against the empty host at least in Linux).1serverhost. As I tried to validate intranet DNS label (known as host name), that will not even include IP addreses. Actual name validation regex sample is here. Anyway, the sole purpose of the subject is not to peform any URL or its part validation (invalid host name should return FAILED on the trigger condition test!), but rather to perform merely EXTRACTION. So if I may here is the simple regex to do just that, and that should work under JS and .net both:where I put some extra stuff like stripping out optional port number (assuming function like ping will be utilized) and few extra checks. First replacement $1 returns the protocol like ftp://, the second $2 returns host, other parts of URL are hidden there. The entry for IsHostReachable condition would be like this:
To debug one can use action ShowMessageBox with text field like this:
Sure you should replace xxxUUIDxxx with your reference entry UUID :)
Last edit: Anonymous 2017-02-05