View Single Post
Old 09-22-2014, 01:28 AM   #1
Chris_Snow
Zealot
Chris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipseChris_Snow can illuminate an eclipse
 
Posts: 148
Karma: 8170
Join Date: Jul 2013
Device: kobo glo
Upper to Lower Case Regex - I'm stuck!

Hello,

I've been trying to teach myself some basic regex to help me with tweaking my epubs via sigil. I managed to sort out most of the stuff on my own, but have run into some trouble with the following...

Trying to change "CHAPTER TWENTY-TWO" to "Chapter Twenty-Two"

I can pick up the Uppercase using as my test case...The FIND field..
Code:
>CHAPTER ([A-Z])([A-Z]+)-([A-Z])([A-Z]+)<
but my replace field fails. I'm using...

Code:
>Chapter \1\L\2-\3\L\4<
The thing is that I thought this should give me the result I'm after but instead I get "Chapter Twenty-two" - the second number being lower case. What am I doing wrong?

Also, can I add regex to pick up "CHAPTER ONE" and also the double (or triple) digit numbers like "CHAPTER TWENTY-TWO" all in the same regex?

What should be in the "Replace Field" to work?

Much appreciated.
Chris_Snow is offline   Reply With Quote