Changing Case in Expression

Jan 10, 2008 at 5:55 PM
Can a regex expression change the case of a word? If the URL is typed in as

http://www.domain.com/Search
http://www.domain.com/search
http://www.domain.com/sEarcH

I would like the expression to be rewitten as lowercase "search". I know that the I makes the expression case-insensitive, and that does not solve my problem really. I need the term passed into my system as lowercase. Of course, I could use the server side language to do this, but I am connecting to third-party software.

The rule is...

RewriteRule ^/(\w+)$ /index.asp?page=$1 I,L

I have tried

RewriteRule ^/(\w+\L)$ /index.asp?page=$1 I,L which is the only thing I could come up with so far via Google. Any help would be appreciated, even if it is to say this can't be done.

Thanks,

Brian






Jan 16, 2008 at 11:18 AM
Brian - had a look on Google myself, Im not 100% sure, but if the regex supports translations (such as in perl) - something like this might work.

tr/A-Z/a-z/

Perhaps the more experienced forum members can jump in here.

Regards,
Paul.
Coordinator
Jan 31, 2008 at 9:50 PM
This cannot be done in IIRF today.

That TR thing is a perl function . The IIRF does not support the use of perl functions in the replacement pattern.
Perl itself supports the use of flags like \L \U \l \u and \E for case conversion, either uppercase or lowercase.

This is a capability of the replacement string function.
It won't be hard to implement.
Coordinator
Jan 31, 2008 at 9:51 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.