[squid-dev] RFC: Adding a new line to a regex
Alex Rousskov
rousskov at measurement-factory.com
Fri Jan 21 18:10:31 UTC 2022
On 1/21/22 12:16 PM, Amos Jeffries wrote:
> On 21/01/22 07:27, Eduard Bagdasaryan wrote:
>> I would concur with Alex that (4) is preferable: It does not break old
>> configurations, re-uses existing mechanisms and allows to apply it
>> only when/where required. I have one more option for your
>> consideration: escaping with a backtick (e.g., `n) instead of a
>> backslash. This approach is used, e.g., in PowerShell.
>>
>> 5a. Recognize just `n escape sequence in squid.conf regexes.
>>
>> 5b. Recognize all '`'-based escape sequences in squid.conf regexes.
>>
>> Pros: Easier upgrade: backtick is rare in regular expressions
>> (compared to '%' or '/'), probably there is no need to convert old
>> regexes at all.
>> Pros: Simplicity: no double-escaping is required (as in (1b)).
>> Cons: Though it should be straightforward to specify common escape
>> sequences, such as `n, `r or `t, we still need to devise a way of
>> providing arbitrary character (i.e., its code) in this way.
> You are mixing up different features offered by several of the *many*
> different languages people call "regex".
Yes, to solve the problem, we should be (and are) considering both
applicable features from other languages/libraries and our own/bespoke
suggestions.
> Squid regex patterns are written in GNU Regular Expression language.
> None of those commonly expected things are features in that ancient
> language.
We cannot modify POSIX regex syntax, and we are not trying to do that.
We can modify how regexes are configured in squid.conf. We need a
solution that works with the existing POSIX regex syntax or on top of
it. Various solutions have been posted and analyzed.
If you want to help, please correct significant analysis mistakes (if
any) and/or add new option(s) to the list, for similar consideration.
Thank you,
Alex.
More information about the squid-dev
mailing list