Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Regex is not Taking Asset path

Avatar

Level 4

Dear All,

 

I have below regex for creating article Content Fragment

 

new RegExp("\\/mnt\\/overlay\\/dam\\/cfm\\/admin\\/content\\/v2\\/createfragment.html\\/content\\/dam\\/content-admin\\/(\\w)+\\/articles\\/[\\w|-]+\\/[\\w|\\s|-]+\\/([\\w\\d]){4}(\\/(\\w)+)?");

 

When we try to create the article CF under the path then it is not taking the bracket as the folder technology-and-activation-group-(taag)

 

http://localhost:4502/assets.html/content/dam/content-admin/global/articles/test/technology-and-acti...

 

Can you please help me here how to change the regex so that it will take bracket.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi @subnaik 

try below regex once will you:
new RegExp("\\/mnt\\/overlay\\/dam\\/cfm\\/admin\\/content\\/v2\\/createfragment.html\\/content\\/dam\\/content-admin\\/(\\w)+\\/articles\\/[\\w|-]+\\/[\\w|\\s|-]+\\/([\\w\\d]){4}(\\/(\\w|\\(|\\))+)?");

By adding \\( and \\) inside the capture group, the regular expression can now match folder names that include both opening ( and closing ) brackets, in addition to word characters (\w).

Hope this helps!

Abhishek Anand

Avatar

Level 4

Hi @abhishekanand_ ,

 

I tried below regex and still it is not working

 

var createArticleUpdatedURLRE = new RegExp("\\/mnt\\/overlay\\/dam\\/cfm\\/admin\\/content\\/v2\\/createfragment.html\\/content\\/dam\\/content-admin\\/(\\w)+\\/articles\\/[\\w|-]+\\/[\\w|\\s|-]+\\/([\\w\\d]){4}(\\/(\\w|\\(|\\))+)?");

 

subnaik_0-1735027439018.png