Regex for Template Allowed paths | Community
Skip to main content
Level 2
January 29, 2016
Solved

Regex for Template Allowed paths

  • January 29, 2016
  • 3 replies
  • 2941 views

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(/.*))

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by sanjays16398239

This one just seems working fine.

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

 

Thanks for the direction though.

3 replies

Kunal_Gaba_
January 29, 2016

Try the following regex pattern for this use case- 

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

Level 2
January 29, 2016

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

sanjays16398239AuthorAccepted solution
Level 2
January 29, 2016

This one just seems working fine.

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

 

Thanks for the direction though.