Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Will sling: match works for multiple URLs if included as regex

Avatar

Level 1

1. Can Sling:match can hold multi string value? If not can some regex be added?

2. Assume I have two paths

path1: content\www.support-abc-de.in

path2: content\www.support-de.in

So if sling of my page matches any of those two paths it should be redirected to the 3rd page using sling:internalredirect.

As path1 and path2 has similarities, is it possible to add some regex lik content\www.support-(.*) In sling:match. Will regex work in such case. Can any one help me on this regex part

2 Replies

Avatar

Level 8

No it doesn't hold multiple values but Yes it does work with regex for multiple ,similar path urls. Refer to https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html

Avatar

Level 1

Thanks Hemant.. i tried creating a regex as “contentt\www.support-.+” Will ts regex matches both the paths above??