Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

Implicit "starts with" caret, but not "ends with" dollar sign?

$
0
0

I was experimenting with variants of my "match url" to better understand RegEx matches.  It seems that the effect of an initial caret in the string holds true, even if the initial "starts with" caret isnot present.

For example, the following "match url"s behave the same:

^investors/media-center

investors/media-center

Both will match on:

http://mydomain.com/investors/media-center

...And neither will match on:

http://mydomain.com/ABCinvestors/media-center orhttp://mydomain.com/investorsABC/media-center

That makes sense to me, because there were no other allowed characters at the beginning of the second "match url".  However, this does not hold true for the "ends with" dollar sign.

The following two "match url"s behave differently:

investors/media-center$

investors/media-center

The latter will match on:

http://mydomain.com/abcinvestors/media-centerABC

 

Here is my rule:

<rule name="Media Center" stopProcessing="true"><match url="^investors/media-center" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false" /><action type="Redirect" url="newsroom/calendar-of-events/event-archive.aspx" appendQueryString="false" logRewrittenUrl="true" redirectType="Permanent" /></rule>


1. Why does "match url" behave as though there is an implicity "starts with", butnot behave as if there is an implicit "ends with"?

2. Why do so many sample/example rules start with the "starts with" caret when the same result is achieved without it?


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>