[squid-users] Regex for URL to include numbers special letters

robert k Wild robertkwild at gmail.com
Sat May 21 07:20:55 UTC 2022


Thanks Amos,

What about if I wanted to put a normal URL in with the URL regex ones like

^zzz-iobuckets-io[0-9]+-[0-9a-z]+\.s3\.amazonaws\.com:[0-9]$
^google\.com$

Would that work


On Sat, 21 May 2022, 03:45 Amos Jeffries, <squid3 at treenet.co.nz> wrote:

>
> Your solution may "works", but only partial.
>
> Diving back to your original request:
>
> On 20/05/22 02:25, robert k Wild wrote:
>  > hi all,
>  >
>  > want to make the below into a regex as after the io..., could be any
>  > number and letter, the - stays in the same position but to make it
>  > simple i just want to make anything a wildcard
>  >
>  > http://zzz-iobuckets-io50-1lnk65fe5gm7n.s3.amazonaws.com/
>  > <http://zzz-iobuckets-io50-1lnk65fe5gm7n.s3.amazonaws.com/>
>  >
>  > something like this ive done but it doesnt work
>  >
>  > "^zzz-iobuckets-io.*.s3.amazonaws.com <http://s3.amazonaws.com>$"
>  >
>
>
> Please notice that your regex does **not** match any valid "URL".
>
> It explicitly only matches strings that start without a scheme. This is
> matching only URI. Specifically it matches URI-authority which HTTP only
> sees in CONNECT request-target's.
>
>
> I think what you actually want is this:
>
>    ^zzz-iobuckets-io[0-9]+-[0-9a-z]+\.s3\.amazonaws\.com:[0-9]$
>
>
> That will limit the successful matches to amazonaws.com sub-domains.
> Preventing things like "zzz-iobuckets-io.s3.amazonaws.com.example.com"
>
>
> FYI, The regex language supported by Squid is the original GNU regex.
> The operators are ^, $, +, *, ?, |, \x, [^-], and (). No character
> classes, back references, or repetition groups.
>
>
> HTH
> Amos
>
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20220521/df206c9e/attachment.htm>


More information about the squid-users mailing list