[squid-users] StoreID Question

Amos Jeffries squid3 at treenet.co.nz
Wed Jan 1 16:18:41 UTC 2025


On 1/01/25 21:27, Robin Wood wrote:
> I've not got time to read your whole email, but you are asking about 
> regular expressions.
> 
> ^http:\/\/[^\.]+\.dl\.sourceforge\.net\/(.*) http:// 
> dl.sourceforge.net.squid.internal/$1
> 
> What this means is to match the first URL and "capture" the bit at the 
> end, the bit in brackets. This then gets rewritten to the second URL 
> with the captured bit added on to the end, that is $1. If you captured 
> two things in brackets the first would be $1, the second $2.
> 
> Do some reading on regex and regular expressions. The basics are 
> relatively easy to understand, beyond that, it can get very complicated 
> very quickly.
> 

Correct. Also, this is a configuration file for the particular helper 
performing StoreID changes. The pattern style and language may/will 
differ based on what the custom helper is doing.

The OP one (Squid provided storeid_file_rewrite) is written in Perl 
language, and passes the list from the file almost directly to the 
"Substitute Regular Expression - s///" function of Perl. As such, the 
documentation of that function is what you need to read for specific 
answers.
  (<https://www.tutorialspoint.com/perl/perl_regular_expressions.htm>)


Amos




More information about the squid-users mailing list