Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!

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

Level 7

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!

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