Expand my Community achievements bar.

SOLVED

Regex for Template Allowed paths

Avatar

Level 3

I am configuring the templates with the allowedpaths property and i want the template to be allowed everywhere under content/www except for content/www/dir1 and content/www/dir2 paths. Please help in forming the regex. I tried the below combinations.

 

^(?!/content/www/dir1(/.*))/^(?!/content/www/dir2(/.*))

1 Accepted Solution

Avatar

Correct answer by
Level 3

This one just seems working fine.

^(?!/content/www/(dir1|dir2)(?:/|$))/content/www(/.*)?

 

Thanks for the direction though.

View solution in original post

3 Replies

Avatar

Employee Advisor

Try the following regex pattern for this use case- 

/content/www/(?!(dir1)|(dir2)).*

Avatar

Level 3

Thanks for the reply but this doesn't allow me to create under /content/www however it restricts in content/www/dir1 and content/www/dir2

Avatar

Correct answer by
Level 3

This one just seems working fine.

^(?!/content/www/(dir1|dir2)(?:/|$))/content/www(/.*)?

 

Thanks for the direction though.