0

I' having problems with using a regular expression in Sharepoint 2013 Search. I insert it into a crawl rule and checked Use regular expression syntax for matching this rule.

I validated my regex on page regex101 so I am 100% sure it is correct.

^(https?:\/\/)([\da-zA-z\.]+)\/([\da-zA-z]+)$

This is the firsts of the crawl rules and I select Exclude, but pages are still searchable. What am I doing wrong?

  • Have you performed an index reset and a full crawl after adding the rule to put it in place with no time delay? – Robert Lindgren Mar 19 '15 at 10:25
  • I tried but event Test in Craw Rules says: no rules match this URL. Test URL: google.com/pager – AdamLato Mar 19 '15 at 10:32
1

I think your problem is based on this:

Protocol part

Regular expression operators cannot be used in the protocol part of the URL. This means, for example, the following RegEx rule cannot be created:

.*//www.microsoft.com/.*

If you try to create a rule like this, the system will add http:// in the beginning and thus make “.*” as the second part of the URL. The resulting rule in this case will be:

http:// .*//www.microsoft.com/.*

which may not be what you intended.

From MSDN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.