Help with REX

Post Reply
jeremy123
Posts: 4
Joined: Tue Feb 05, 2019 11:15 am

Help with REX

Post by jeremy123 »

I am looking to create an Exclusion REX that will exclude a certain folder that has a certain word anywhere in the URL.

Example:
/help/abc_image.htm
/help/defg_image_hi.htm
/help/jklmn.htm#opqrs_image.htm

I want to exclude anything in the help folder with the word image in the URL. Image will always be after the help folder and it will always be in the name of the page that will end in htm if that helps.

In addition to this I need to exclude another word, in the same folder, that has a space in it (another%20image) in this example) like this:
/help/index.htm#abc%20another%20image.htm

I have this in the Exclusion REX which does not work:
>>/help/.*_image.*.htm


Thanks!
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Help with REX

Post by mark »

Try
>>/help/=!image*image
jeremy123
Posts: 4
Joined: Tue Feb 05, 2019 11:15 am

Help with REX

Post by jeremy123 »

Thanks this seems to work. Just to clarify this statement is saying that starting at /help/ and moving left to right find /help/ and at least one occurrence of image. Is this correct?
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Help with REX

Post by mark »

correct
jeremy123
Posts: 4
Joined: Tue Feb 05, 2019 11:15 am

Help with REX

Post by jeremy123 »

Thanks Mark, you are the best. Can you please help me with another one? This one would start with /help/, like the other but then I need it to find a dash or underscore immediately followed by one or two characters and then .htm. Here is a regex that I have used before in javascript for the part after /help/:
var patt = new RegExp("\\S*[_-].{1,2}\\.htm");

Examples of things I would want it to find would be like this:
/help/Project/Book/MB-b.htm
/help/Project/Trade/lb-3.htm
/help/Project/Learn/home_page_g.htm
/help/Train/BTP1-1a.htm
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Help with REX

Post by mark »

Assuming .htm is the end of the URLs

/help/=!/help/*[_\-]=[^_\-]{1,2}\.htm=>>=
Post Reply