Post Reply 
Your browser is no longer supported.
Jan. 15, 2015, 05:50 AM
Post: #16
RE: Your browser is no longer supported.
(Jan. 14, 2015 09:48 PM)zoltan Wrote:  An example: After looking at the matching language page, I would have said that "[^/]+" only means match a run of anything that's not "/". I don't see where the "OR nothing" comes in. It would seem that "[^/|]+" would be the way to say anything that is not "/" OR nothing -- similar to "(www.|)" meaning match "www." OR nothing.

We get to use it as given. Wink

[] says match once
[]+ says blindly match all or nothing
[^/|]+ says blindly match anything that isn't a / or a | until there are no more OR nothing.

(Jan. 14, 2015 09:48 PM)zoltan Wrote:  With respect to URLs, what's the advantage of using "[^/]" instead of "(^/)" ? Doesn't the second one also include "anything that's not "/"?

[^/] consumes the characters that it matches while (^/) tests for but does not consume them.

(Jan. 14, 2015 09:48 PM)zoltan Wrote:  And I'm probably missing what shoud be obvious, but why should the forward slash not be matched?

[^/]++ is one way to limit matching to the part of the address before the slash. *google.com/ would search to the end of every url and might find matches in the path or query of the address.
Add Thank You Quote this message in a reply
Jan. 15, 2015, 07:16 PM
Post: #17
RE: Your browser is no longer supported.
Oh, I'm not arguing that it should be the way I saw it, I'm just trying to understand how it works. What's being matched isn't very complex, but apparently my mind is wedded to particular ways of describing relationships and takes some training to think in other terms (or I'm just dense, lol).

(Jan. 15, 2015 05:50 AM)JJoe Wrote:  [] says match once
[]+ says blindly match all or nothing
[^/|]+ says blindly match anything that isn't a / or a | until there are no more OR nothing.

In "[^/|]" I was thinking that "|" was being used as a meta character that meant OR. Not true? If as you say, it's trying instead to avoid matching the characters "/" and "|", why isn't the escape character "\" used before the "|" ?

And the "or nothing" description is still confounding me. Going back to post #14, what specifically is in the "[^/]+" that indicates "or nothing" ?
According to the matching rules, the "+" supposedly "indicates a run of repeating characters." The example used says: [abc]+ would match a run of any characters "a","b",or "c" like "ababccba"
So, since there's no OR symbol "|" in that expression, I'm having trouble getting anything but "match a run of anything that's not a "/" "
Add Thank You Quote this message in a reply
Jan. 15, 2015, 09:23 PM
Post: #18
RE: Your browser is no longer supported.
(Jan. 15, 2015 07:16 PM)zoltan Wrote:  In "[^/|]" I was thinking that "|" was being used as a meta character that meant OR. Not true? If as you say, it's trying instead to avoid matching the characters "/" and "|", why isn't the escape character "\" used before the "|" ?

OR is implied inside []. So, I assume, Scott chose to remove its powers when inside []. Saves us having to type \|.

(Jan. 15, 2015 07:16 PM)zoltan Wrote:  And the "or nothing" description is still confounding me. Going back to post #14, what specifically is in the "[^/]+" that indicates "or nothing" ?
According to the matching rules, the "+" supposedly "indicates a run of repeating characters." The example used says: [abc]+ would match a run of any characters "a","b",or "c" like "ababccba"
So, since there's no OR symbol "|" in that expression, I'm having trouble getting anything but "match a run of anything that's not a "/" "

Only + may be followed by {n,n}. Scott chose to make the default behaviour +{0,*}. So the + indicated "or nothing".

Proxo's Help isn't perfect. When in doubt use the test window and experiment.
Add Thank You Quote this message in a reply
Jan. 16, 2015, 08:12 AM
Post: #19
RE: Your browser is no longer supported.
Thanks. Now I'm starting to get it. True about the help file. Very useful to know that "{0,*}" is assumed after a "+"

I spoke too soon when declaring that the faked Firefox 36.0 version was working with youtube. The matching code example is good, but faking that particular FF version causes videos jump to the end and show the finished screen. Good news is, setting it to version 31.0 seems to work fine and triggers no update warnings.

Code:
[^/]++.youtube.com/$SET(0=f_ua_§Mozilla/5%2e0 (Windows; U; Windows NT 6%2e1; en-US; rv:31%2e0) Gecko/20130401 Firefox/31%2e0.)

Anyone wanting to fake a browser/version can find user agent strings here.
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: