fail2ban <HOST> regex alias explanation
regex
Solution
`(?P<name>regex)` Captures the text matched by "regex" into the group "name". The name can contain letters and numbers but must start with a letter.
http://www.regular-expressions.info/refext.html
(?:::f{4,6}:)?(?P<host>\S+)
Debuggex Demo
Problem
I've set up fail2ban to protect a host, and I've noticed this piece of information ``` #_daemon = asterisk # Option: failregex # Notes.: regex to match the password failures messages in the logfile. The # host must be matched by a group named "host". The tag "<HOST>:.*" can # be used for standard IP/hostname matching and is only an alias for # (?:::f{4,6}:)?(?P<host>\S+) # Values: TEXT ``` How does the `(?:::f{4,6}:)?(?P<host>\S+)` regex work? I've been trying it in a few different regex checkers and explainers and none could parse it, at least the `(?P<host>\S+)` part.