Search squid archive

Re: correct regular expression to use to capture all

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/8/23 17:49, robert k Wild wrote:
So will this

(^|\.)redshift3d\.com$

I know it will match

Blah.redshift3d.com and redshift3d.com

But what about

Blah.Blah.redshift3d.com

It will also match, for the same set of reasons.

FWIW, I am worried that you keep asking about specific basic matching examples. If necessary, you can test such matches online[1] or using something like "grep -E" (not to mention Squid itself). The answers here will vary in quality and will usually not cover what you really want to know -- what input the regular expression will (not) match besides your specific examples. Have you tried reading regular expression tutorials and using tools[1] that explain the meaning of specific regular expressions? There ought to be a better way to learn how regular expressions work!

[1] For example: regexr.com/7gms6


Cheers,

Alex.


On Sat, 8 Jul 2023, 22:32 Alex Rousskov wrote:

    On 7/8/23 06:14, Stuart Henderson wrote:
     > On 2023-07-07, robert k Wild <robertkwild@xxxxxxxxx
    <mailto:robertkwild@xxxxxxxxx>> wrote:
     >> --===============6398075081121841451==
     >> Content-Type: multipart/alternative;
    boundary="000000000000a03dcc05ffeb4428"
     >>
     >> --000000000000a03dcc05ffeb4428
     >> Content-Type: text/plain; charset="UTF-8"
     >>
     >> hi all,
     >>
     >> i know ive been talking about this before but i want to
    understand why i
     >> cant use this regex
     >>
     >> (^|.*)redshift3d.com <http://redshift3d.com>$
     >
     > this matches anythingredshift3d[any single character or nothing]com

    Correction: A regular expression "." does _not_ match "nothing" (i.e.
    zero characters).

    In some contexts, "." may not even match some special single
    characters,
    but those contexts are probably not applicable to this thread scope.


     >> instead i have to use this
     >>
     >> (^|\.)redshift3d.com <http://redshift3d.com>$ OR
     >
     > this matches redshift3d[any single character or nothing]com
     > or anything.redshift3d[any single character or nothing]com

    ... or .redshift3d.com <http://redshift3d.com>

    Same "nothing" correction here.


     >> (^|\.)redshift3d\.com$
     >
     > this only matches redshift3d.com <http://redshift3d.com> or
    anything.redshift3d.com <http://anything.redshift3d.com>

    ... or .redshift3d.com <http://redshift3d.com>


    Alex.


     > So, if you only want to match on things exactly in the
    redshift3d.com <http://redshift3d.com>
     > domain and no others, you need the last one.



    _______________________________________________
    squid-users mailing list
    squid-users@xxxxxxxxxxxxxxxxxxxxx
    <mailto:squid-users@xxxxxxxxxxxxxxxxxxxxx>
    http://lists.squid-cache.org/listinfo/squid-users
    <http://lists.squid-cache.org/listinfo/squid-users>


_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users



[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux