/etc/map/http - How to change lower case to UPPER case in regex in /etc/map | Community
Skip to main content
Level 4
October 16, 2015
Solved

/etc/map/http - How to change lower case to UPPER case in regex in /etc/map

  • October 16, 2015
  • 4 replies
  • 1275 views

Hi all,

 
End user will hit our site using following pattern for locale (/mysite/us/en/home.html) but in our CQ this page is located under /content/mysite/en_US.html . And top of this we have 50 different locales.
 
So we can write rules on webserver which is pretty simple and things works fine. 
 
Now when we am going to write /etc/map/http rule then i have to repeat same rule 50 times for 50 locales. Is there any way to CONVERT lower case to UPPER CASE . This way I have to write only ONE RULE in /etc/map. I read on some blog that if we add "\U" in the REGEX then it will convert the value to UPPER CASE. But some how this is not working in CQ (\E meaning end of case conversion)
http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/
 
 
For example (below is the rule which i added)
 
sling:internalRedirect  /content/mysite/$1_\\U$2\\E/$3.html
sling:match           mysite/([^/])/([^/]+)/([^/])
 
When I test my rule in Sling Resolver seems like it does not recognize \U or \E and it just displys them as U & E letter 
 
below is the input and output
input : /mysite/de/de/home
output : /content/mysite/de_UdeE/home.html   (see in BOLD nothing happened here instead of displaying U & E)
 
Please let me know if you know of a way to deal with this situation.
 
Thanks in advance.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

Best practice for this is (managing different domains) is talked about here:

http://www.cognifide.com/blogs/cq/multidomain-cq-mappings-and-apache-configuration/

not sure of other community members but I have never heard of simplying using uppercase.

4 replies

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

Best practice for this is (managing different domains) is talked about here:

http://www.cognifide.com/blogs/cq/multidomain-cq-mappings-and-apache-configuration/

not sure of other community members but I have never heard of simplying using uppercase.

JK_Kendall
Level 9
October 16, 2015

Why does Sling not handle \U...\E?

It's likely because Java does not support the Perl preprocessing operations \l, \u, \L, and \U.

http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html

Sham_HC
Level 10
October 16, 2015

It is not possible in jcrresolver. You might need to write a filter or deal at web server level with mod_rewrite

http://stackoverflow.com/questions/18440287/filter-request-url-before-any-processing-in-cq5-6

Level 4
October 16, 2015

Thanks K Kendall , Sham  , smacdonald2008  for your valuable reply on this. Seems like its not possible :)