HAProxy community

Loading regex patterns from a file?



For flexibility reasons I would like to switch from base_sub to base_reg in a line like this :
current : acl blacklist_a base_sub -i -f /some/dir/blacklisted_urls
idea : acl blacklist_a base_reg -i -f /some/dir/blacklisted_urls

Lines can be read from the file even with base_reg, but they are only interpreted as strings (., +, ?, *, + not interpreted at all), so in effect it is exactly like base_sub.

I have tried to find some examples but could not find a single “base_reg (-i)? -f”.

Is it possible to load one or several regex patterns from a file?




acl blacklist_a base_reg -m reg -f /some/dir/blacklisted_urls


It doesn’t work.

We are still on haproxy 1.6 but the documentation is basically the same for both on this.

Thanks for trying though :slight_smile:


I guess it has to be base instead of base_reg:

acl blacklist_a base -m reg -i -f /some/dir/blacklisted_urls


Thanks a lot. It works :slight_smile:

A “-i” can be added before or after “-m reg” for case insensitive regexes.