I'm sure this very easy, but I am having trouble writing this path correctly. I have no problems triggering the command using:
if(window.location.pathname.match(/^\/Home-Blog/)) {$('#maincolumn').remove();}
But for another case, I need the pathname to be longer, with the following directory:
/Home-Blog/CategoryBlogID
Any way I try to insert it, it doesn't seem to work. How do I plug in the path to "CategoryBlogID"?
Thank you!
I'm not totally sure I understand your question, but if you want to match
this RegExp should do the trick:
/^
start of string\/
a forward slashHome-Blog
the text "Home-Blog"(\/)*
a forward slash zero or more times (will also match /Home-Blog////CategoryBlogID) because of this(CategoryBlogID)?
the string "CategoryBlogID" zero or one timeshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references