[ 
https://issues.apache.org/jira/browse/SLING-3835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14095520#comment-14095520
 ] 

Bob Paulin commented on SLING-3835:
-----------------------------------

Since it's going to be interpreted as a string first you might have to double 
or triple escape.

Also have you tried using the \Q and \E to escape the pattern?


Here's a small sample:
{code}
    public static void main(String[] args) {
                String test ="/1213/213$/234";
                
                Pattern test1 = Pattern.compile(test);
                Matcher matcher1 = test1.matcher(test);
                System.out.println("match? " + matcher1.matches());
                //match? false
                

                Pattern test2 = Pattern.compile("\\Q" +test + "\\E");
                
                Matcher matcher2 = test2.matcher(test);
                
                System.out.println("match? " + matcher2.matches());
                //match? true
                
                
                Pattern test3 = Pattern.compile(test.replaceAll("\\$", 
"\\\\\\$"));
                Matcher matcher3 = test3.matcher(test);
                System.out.println("match? " + matcher3.matches());
                //match? true
                
        }
{code}

> Vanity URL's with $ symbol do not get resolved
> ----------------------------------------------
>
>                 Key: SLING-3835
>                 URL: https://issues.apache.org/jira/browse/SLING-3835
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>            Reporter: Neha Sinha
>
> Use case (CQ 5.6.1):
> If I set a vanity URL containing $ like : 
> /fathers-day-gifts/fathers-day-gifts-under-$200, the path does not gets 
> resolved and gives a 404 error. However, the value in the repository is 
> stored as it is.
> Now ,$, the dollar denotes the end of line anchor.
> Example: "b$" matches a "b" at the end of a line.
> Example: "^b$" matches the empty line.
> But, this does not work even on changing $ to URL encoded value or when used 
> with double slash to escape. 
> On removing the $ sign, things look and work as expected.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to