[
https://issues.apache.org/jira/browse/FREEMARKER-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
buddie.wei closed FREEMARKER-126.
---------------------------------
Resolution: Fixed
My fault, the third parameter as 'ris' will success!
> regularExpression cannot use Java pattern as described in the document
> ----------------------------------------------------------------------
>
> Key: FREEMARKER-126
> URL: https://issues.apache.org/jira/browse/FREEMARKER-126
> Project: Apache Freemarker
> Issue Type: Bug
> Components: documentation
> Affects Versions: 2.3.26-incubating
> Reporter: buddie.wei
> Priority: Major
>
> [https://freemarker.apache.org/docs/gloss.html#gloss.regularExpression]
> "FreeMarker uses the variation of regular expressions described at:
> [http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html]"
>
> But in fact, it is not effect if i use java pattern.
> For example, i want to remove the domain of a url, like
> "http://www.abc.com/de/fg" or "https://192.168.1.1:8080/de/fg".
> The result i expect is "/de/fg".
> In java,
>
> {code:java}
> url.replaceFirst("http[s]?://[\\w\\.:\\d]*", "");
> {code}
> {color:#172b4d}The code above can realize my intention.{color}
> {color:#172b4d}In freemark,{color}
> {code:java}
> ${url.loginAction?replace('http[s]?://[\\w\\.:\\d]*','','i')}
> {code}
> {color:#172b4d}It will return the origin url, like
> "http://www.abc.com/de/fg", not my expect.{color}
>
> {color:#172b4d}what can i do?{color}
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)