0

I'm looking to convert

\item helicopter

\item airplane

etc to

\item Helicopter

\item Airplane

etc.

Looking around the web it seems like I should be finding

(\\item) ([a-z])

and replacing with

\1 \U2

which should signify that the second backreference is to be replace with an upper-case version of the same letter, but it's not working. It's just replacing it with "\item \U2elicopter".

Any ideas?

I'm using MikTex with TexStudio

Cheers

  • 2
    you have tagged this with l3regex but I think you want to do this as an edit to the source so it's a texstudio question not a tex one, can you confirm? – David Carlisle Apr 29 at 13:28
  • use ctrl+H for find and replace – js bibra Apr 29 at 13:36
  • Hey David, yeah I tried to just tag it as regex but it wouldn't let me. I'm new to stackexchange so not entirely sure how it works, sorry. Yeah, I'm trying to edit the source. – timjack Apr 29 at 13:56
  • Not all regular expression systems support backrefs or case change functions I don't have texstudio so I can't tell you if they do (otherwise the syntax should probably be \U\2) but there are plenty of texstudio users here someone will tell you. – David Carlisle Apr 29 at 14:08
  • When I tried that it just replaces it with "\U" followed by backref 2. I guess it just doesn't support it in that case. Ah well, thanks anyway. – timjack Apr 29 at 14:46
1

Like many of the more obscure features of regular expressions, case changing is not supported by all implementations. TeXStudio does not seem to support it, though I could not find any information on it's regex support in the manual.

Since this is something you will not have to do often, I would imagine it is okay to switch to another editor that does support it for this operation, like Notepad++. Note that the exact syntax for regular expressions may differ a bit from editor to editor. Here is an overview of the different conventions. Notepad++ uses the Boost regular expression engine, so both \1 \u\2 and \1 \U\2 work (where \u replaces only the first letter of the match and \U the entire match, which is the same for your expression).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.