Can anyone enlighten me as to why the following would not work in 'https -> force the following sites'?:
https://(?:encrypted|mail|docs)\.google\./(?:com|co\.uk)\b.*
or
(?:encrypted|mail|docs)\.google\./(?:com|co\.uk)\b.*
Many thanks in advance
Regular expression issue
-
- Posts: 13
- Joined: Mon Nov 08, 2010 5:24 pm
Regular expression issue
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET4.0C)
- Giorgio Maone
- Site Admin
- Posts: 9455
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: Regular expression issue
There's an extra (wrong) slash after "google\.", which causes both pattern to match an hypothetical (and unlikely) "google./com" rather than "google.com/".Dukeswharf wrote:Can anyone enlighten me as to why the following would not work in 'https -> force the following sites'?:
https://(?:encrypted|mail|docs)\.google\./(?:com|co\.uk)\b.*
or
(?:encrypted|mail|docs)\.google\./(?:com|co\.uk)\b.*
Many thanks in advance
Also, the first pattern will never match what it's meant to match (a plain HTTP request to be turned into HTTPS), while it may match false positives where https:// is not anchored to the beginning of the URL.
Better
Code: Select all
^https://(?:encrypted|mail|docs)\.google\.(?:com|co\.uk)/
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
-
- Posts: 13
- Joined: Mon Nov 08, 2010 5:24 pm
Re: Regular expression issue
Many thanks for the clarification.
I have noticed that, in firefox error console, an [NoScript HTTPS] Forced URI https://[selection].com is not generated for any of 'or' selections, which is the case if I simply write *.google.com, for example.
Is this an issue or normal behavior?
Many thanks in advance.
I have noticed that, in firefox error console, an [NoScript HTTPS] Forced URI https://[selection].com is not generated for any of 'or' selections, which is the case if I simply write *.google.com, for example.
Is this an issue or normal behavior?
Many thanks in advance.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET4.0C)
- Giorgio Maone
- Site Admin
- Posts: 9455
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: Regular expression issue
It's an issue with my regexp, which contained a typo.Dukeswharf wrote:Is this an issue or normal behavior?
In fact, I wrote
but in the end I gave you an useless ^https: regexp anyway.Giorgio Maone wrote: Also, the first pattern will never match what it's meant to match (a plain HTTP request to be turned into HTTPS)
Obviously it should have been
Code: Select all
^http://(?:encrypted|mail|docs)\.google\.(?:com|co\.uk)/
Code: Select all
^[^:]+://(?:encrypted|mail|docs)\.google\.(?:com|co\.uk)/
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13