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
Post Reply 


Messages In This Thread
RE: Your browser is no longer supported. - JJoe - Jan. 15, 2015 05:50 AM

Forum Jump: