when replacing both case and content

General questions about using TextPad

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
redcairo
Posts: 39
Joined: Fri May 06, 2011 6:34 am

when replacing both case and content

Post by redcairo »

In the help file it showed that I could search for content and replace it with upper or lowercase (in whole or part) using backslash "u" or "U" with ampersand. This works great.

But I can't figure out what to do when I have to specify the \# of a paren value I am replacing, at the same time I am specifying the case change of its content.

For example, I have multiple choice question/answers where the response looks like this (letter at start of line could be A-F):

A. Correct, something else here.

I need to change it to say:

a. Correct. Something else here.

So the option letter changed at front, and the capitalization changed on the first letter of the now-a-new-sentence that follows.

I don't understand how to mix the (content) \1 and the (content) \l& elements.

I'd sure appreciate some advice! Thanks!

PJ
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

Use \u\n or \l\n to change the case of the first letter of the backreferenced string. Or use \U\n\E or \L\n\E to change the case of the entire backreferenced string.

For your example:

Find what: ([^,]*),_(.*) [substitute a space for the underscore]
Replace with: \l\1._\u\2 [substitute a space for the underscore]

Enable POSIX regular expression syntax in Configure > Preferences > Editor.
redcairo
Posts: 39
Joined: Fri May 06, 2011 6:34 am

Post by redcairo »

I see -- so you just use the case function first then the replace and it "knows." Thank you very much!

PJ
Post Reply