Hi Friends,
I want to regex for the template appear in some path. Example: I want the Article template will appear in the path as below when i create page.
content/hlo/en/peppa/xx/yyyy
xx is country code with two letter
yyyy is the city name (not limited letter)
Example some right path:
content/hlo/en/peppa/us/newyork
content/hlo/en/peppa/uk/london
content/hlo/en/peppa/vn/hanoi
I was tried this regex "/content/abc/zh/properties/us(/[^/]+){1,1}$" but I want the us is dynamic. So I tried "/content/abc/en/properties/([A-Z][A-Z])(/[^/]+){1,1}$" it doesn't work.
/content/abc/en/properties/([A-Z][A-Z])(/[^/]+){1,1}$
In this regex [A-Z][A-Z] for two letter ex: us , uk, vn
Please help me how to regex it.
Thank you so much,
BienHV
Solved! Go to Solution.
Hi,
String length or range you can specify inside {}
example -
/content/hlo/en/peppa/[a-zA-Z]{2}/[a-zA-Z]{1,}
Views
Replies
Total Likes
Hi,
String length or range you can specify inside {}
example -
/content/hlo/en/peppa/[a-zA-Z]{2}/[a-zA-Z]{1,}
Views
Replies
Total Likes
Also - what AEM version are you using? Looks like you are working in Static templates.
Views
Replies
Total Likes
Thank you for your help,
I used this code /content/hlo/en/peppa/([a-z][a-z])(/[^/]+){0,0}$ it work. However, I want to set a condition if the path as /content/hlo/en/peppa/sg the template will not appear.
How to do that?
I am using AEM 6.2
Thank you so much,
BienHV
Views
Replies
Total Likes
Views
Replies
Total Likes
Thank you for your help.
I tried but it doesn't work. I want the template accept the path /content/hlo/en/peppa/([a-z][a-z])(/[^/]+){0,0}$
Example: accept any path with type content/hlo/en/peppa/xx with xx is a letter a-z
content/hlo/en/peppa/us
content/hlo/en/peppa/uk
content/hlo/en/peppa/vn
and not accept the path:
content/hlo/en/peppa/sg
Views
Replies
Total Likes
Hi,
try /content/hlo/en/peppa/(?!sg)([a-z][a-z])(/[^/]+){0,0}$
It worked for me.
Thank you so much!
Views
Replies
Total Likes