Woundorf / foxreplace

Replace text in webpages
https://addons.mozilla.org/firefox/addon/foxreplace/
GNU General Public License v3.0
89 stars 22 forks source link

Is there support for escape sequences \U \F \L in FoxReplace? #369

Closed iG8R closed 6 months ago

iG8R commented 6 months ago

Hello. I wonder if FoxReplace supports \U \F \L escape sequences? I need to replace, e.g. the word "one" on the page with the word "One", the first character of which is capitalized. How could I do this?

Woundorf commented 6 months ago

I don't know what those escape sequences mean, but the easiest way is to do the direct literal substitution of "one" with "One". However, if you want to replace any word and capitalize the first letter, you could use the "replace with function" feature, where you can transform the input with a custom JavaScript function.

iG8R commented 6 months ago

Thank you so much for such a quick response!

\U1 inserts the first backreference in uppercase, \L1 in lowercase and \F1 with the first character in uppercase and the remainder in lowercase. Finally, \I1 inserts it with the first letter of each word capitalized, and the other letters in lowercase. Source: Goyvaerts, Jan (2006). Regular Expressions: The Complete Tutorial. Lulu.com. p. 35. ISBN 1411677609. Google Books. Retrieved on June 25, 2010.

Just in case anyone else is facing the same issue.

The following JavaScript works fine:

or