\l operation in regular expressions

K

Kalle Anka

I've started to play around with regexps in Python and I tried
something like this

print re.sub( r'(\bw\w+\b)', r'\u\1', 'will it work')

and get

\uwill it \uwork

when I had expected

Will it Work

I tried to find some documentation about this but I can't find anything
that says if operations like \l \L \u \U etc are supported or not. It
doesn't look like it supported? What is the "Python way" of doing this,
writing a function and use that as the replacement?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top