Sublime Forum

Regex: The Case Problem of Randomly Changing Subexpressions(bug?)

#1

I want to extract information from text. For example:


\bibitem[{Aguaron and Moreno-Jim{\'e}nez(2003)}]{aguaron2003geometric}

\bibitem[{Alonso and Lamata(2006)}]{alonso2006consistency}

I made a regex,

Find:

(\\bibitem)(\[\{.+?\}\])(\{.+?\})

Replace by: $1$3

The output should be:

\bibitem{aguaron2003geometric}
\bibitem{alonso2006consistency}

But what I got was this.

\bibitem{aGuaron2003geOmetric}
\bibitem{aLonso2006coNsistency}

I wonder why? What happened to the capitalization of the letters?
Local environment: mac mojave + sublime textx3 v3.2.1 build 3207

Can anyone help me?

0 Likes

#2

You may want to verify that Preserve Case is not turned on:

image

This shows the location of the option in the Adaptive theme that ships with Sublime (here it’s turned off); if you use a different theme the button will look different, but it will be in the same position.

0 Likes

#3

Thank you very much. This question has been puzzled for a long time. I tried many ways to check whether the regular expression is correct. I almost suspected it was a bug.

0 Likes