この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
This is the code I have at /etc/map.prod.publish/https/mysite.net/content/.content.xml to redirect some matching URLs. I'm trying to use a regular expression with a backreference, but when I go to publish the changes, I get an error about the '<' character not being allowed in the sling:match property. How do I escape that character? "<" didn't work.
The code:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Mapping"
sling:match="^/*(?!$|(?:content|apps|etc|libs)/)(?:((?:(?=((?=([^/]+))\\3/+))\\2)*)([^/]+)(?<!\\.html)(?:(\\.html)|/+))$"
sling:redirect="[/$1$4]"
sling:status="302"
/>
The error message:
03.03.2022 18:25:11.369 *ERROR* [qtp1433131481-1750] org.apache.jackrabbit.vault.fs.io.Importer E /etc/map.prod.publish/https/mysite.net/content (org.xml.sax.SAXParseException; systemId: file:///C:/AEM/mysite.net/author/jcr_root/etc/map.prod.publish/https/mysite.net/content/.content.xml; lineNumber: 5; columnNumber: 99; The value of attribute "sling:match" associated with an element type "jcr:root" must not contain the '<' character.)
解決済! 解決策の投稿を見る。
表示
返信
いいね!の合計
try with <
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling ="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr ="http://www.jcp.org/jcr/1.0" jcr:primaryType ="sling:Mapping" sling:match ="^/*(?!$|(?:content|apps|etc|libs)/)(?:((?:(?=((?=([^/]+))\\3/+))\\2)*)([^/]+)(?<!\\.html)(?:(\\.html)|/+))$" sling:redirect ="[/$1$4]" sling:status ="302"/>
Hi @wizard04wsu ,
I did try the regex in my local system and it does work and not breaking. Which AEM version are your using? Also, can you try putting an escape character in front of "<" and check if this fixes. Use below regex:
^/*(?!$|(?:content|apps|etc|libs)/)(?:((?:(?=((?=([^/]+))\\3/+))\\2)*)([^/]+)(?\<!\\.html)(?:(\\.html)|/+))$
I'm using AEM 6.5. I tried escaping with a backslash, but got the same result.
try with <
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling ="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr ="http://www.jcp.org/jcr/1.0" jcr:primaryType ="sling:Mapping" sling:match ="^/*(?!$|(?:content|apps|etc|libs)/)(?:((?:(?=((?=([^/]+))\\3/+))\\2)*)([^/]+)(?<!\\.html)(?:(\\.html)|/+))$" sling:redirect ="[/$1$4]" sling:status ="302"/>
It doesn't need to be escaped. I found another error further up in the log and resolved it. This was just some weird side effect.
Also, please don't assume that your reply is the answer. If you can change the correct answer for this post, please do.
Hi @wizard04wsu
Could you please post a correct answer?
@kautuk_sahni - could you please change the correct answer as per @wizard04wsu response?