Hi, On Tue, 2008-06-03 at 17:39 +1000, Adam Carter wrote: > I want to filter the strings; ? <something> http:// or ? <something? > https:// or ? <something> ftp:// from URLs in apache. I know i need to > escape ? but i'm not sure about / / needs to be escaped in perl if your regex delimiters are / as well, but here you use ' so I would _hope_ that you don't need \/\/ sort of syntax. YMMV.
> and i've used '(something|otherthing|whatever)' to make the 'or's > work. I usually do perl, but it should be the same... Actually on reading further, "Apache uses Perl Compatible Regular Expressions provided by the PCRE library." Neat. You should be viewing this with a fixed width font too :) > <LocationMatch '(\?.*http:\/\/|\?.*https:\/\/|\?.*ftp"\/\/)'> typo here==============================================^ how about taking the common bits out of the () '\?.*(http|https|ftp)://' and it's good practise to use ^ if that's what you're expecting: '^\?.*(http|https|ftp)://' > Order allow,deny > Deny from all > </LocationMatch> > > is that regex correct? Will egrep use the exact same regex syntax (so > i can use it to check?) I think they're essentially the same, with the exception of some classes (like [:punct:] or [\d]). egrep may need some extra escaping so as not to confuse your shell. The best way to test is to use the real program, so see if you can get info out of your logs to help. hth, -- Iain Buchanan <iaindb at netspace dot net dot au> I tripped over a hole that was sticking up out of the ground. -- gentoo-user@lists.gentoo.org mailing list