7
使用Solr的3.5.0和我的schema.xml中我使用下面的標記語句的結束,以及一個象徵性的令牌替換結束標點符號:如何在Solr schema.xml中的正則表達式中轉義「<」字符?
<charFilter class="solr.PatternReplaceCharFilterFactory"
pattern="(?<=[^.!?\\s][^.!?]*(?:[.!?](?![']?\s|$)[^.!?]*)*)[.!?]+(?=\\s|$)"
replacement=" monkeysentence"/>
我不知道這是否會即使是爲我想要的而工作,但首先我需要解決在第一個''中轉義'<'字符的問題? '看上去很後面。
我得到以下錯誤:
org.xml.sax.SAXParseException: The value of attribute "pattern"
associated with an element type "null" must not contain the '<' character.
我使用 '\' 作爲嘗試:
pattern="(?\<=[^.!?\\s][^.!?]*(?:[.!?](?![']?\s|$)[^.!?]*)*)[.!?]+(?=\\s|$)"
,但我得到了同樣的錯誤。
那完美的作品。謝謝。 – Ramsel 2012-04-19 03:49:16