I am trying to create a regular expression to see all my landing pages in one search result.

This is what I have so far, but this regular expression does not consider the (\W|$)), meaning that I receive results which that word is not the end of the string (I know I would need to add the beginning and ending / to be getting any meaningful data)


I tried to follow the Google's guide again to no avail:


You have a syntax error in your final regular expression. You are missing a pipe between "about" and "pages". (Edit: this appears to be intentional as the page is named "AboutPages".)

Instead of (\w|^) and (\W|$) you could try \b which is "word boundary". I plugged that into a regular expression tester and it seems to work well: http://regex101.com/r/tF1lZ4

| improve this answer | |
  • Hi there eagle eyes Stephen, well I have unfortunately a landing page that actually is called AboutPages... But you were absolutely right with \b... with a minor modification it worked like a charm: ^/\b([Pp]rojects|[Aa]wards|[Dd]ownload|[Aa]bout[Pp]ages|[Ee]xperts|[fF]orum)\b$ – sogathon Jun 17 '14 at 10:54

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.