Forum Moderators: phranque

Message Too Old, No Replies

Combining RewriteConds

RegEx Question

         

keyplyr

9:30 am on Mar 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Having trouble combining these two RewriteConds:

RewriteCond %{HTTP_USER_AGENT} Image\ (Strip¦Suck) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^ImageBot [NC,OR]

This didn't work:

RewriteCond %{HTTP_USER_AGENT} Image(Bot)?\ (Strip¦Suck) [NC,OR]

What am I doing wrong? Thanks.

Robber

11:49 am on Mar 7, 2004 (gmt 0)

10+ Year Member



I'm just finding my feet with these rewrites but do you need to escape the backslash and make the second brackets optional:

RewriteCond %{HTTP_USER_AGENT} Image(Bot)?\\ (Strip¦Suck)? [NC,OR]

keyplyr

4:43 pm on Mar 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well the backslash is there to escape the space, but you are correct about the second set of suffixes needing a question mark. Thanks, I'll try it.

<added>

Nope, still no joy

<added><added>

Got it


RewriteCond %{HTTP_USER_AGENT} Image(Bot)?[\ (Strip¦Suck)]? [NC,OR]

Robber

6:19 pm on Mar 7, 2004 (gmt 0)

10+ Year Member



Ah, I didnt know you needed to escape a space - I'll make a note of that.

So I take it the regular expressions aren't exactly the same as in perl?

dcrombie

12:01 pm on Mar 8, 2004 (gmt 0)



RewriteCond %{HTTP_USER_AGENT} Image(Bot¦\ Strip¦\ Suck) [NC]

;)

keyplyr

5:55 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ahhhh - dcrombie

Amazing how I like to complicate things.