8

I have pages with links like:

href="FileName-One-Example.html"

I need to a regular expression command with Notepad++ to change the case of the anything between href=" nad the ending " to lowercase, and leave everything before and after it in the page as is.

So the result is:

href="filename-one-example.html"
Mike
  • 2,051
  • 4
  • 28
  • 46

1 Answers1

15

This is the correct regexp to use:

Find: (href=")([^"]*)
Replace: \1\L\2\E

Edit: changed the second \L to \E as suggested in the comments.

Oram
  • 1,589
  • 2
  • 16
  • 22
krisku
  • 3,916
  • 1
  • 18
  • 10
  • 2
    Note that the text to be lower-cased must be between the two `\L`. – Omar May 22 '14 at 16:12
  • 5
    @Omar That is incorrect. You need to put "\E" when you want to stop the "upper/lower" command. See here: http://stackoverflow.com/questions/1159343/convert-a-char-to-upper-case-using-regular-expressions-editpad-pro – Zoran Pavlovic Sep 05 '14 at 09:58
  • I used Notepad++ to convert naming conventions in a load of C# code (hundreds of files). The old convention for fields was `mAbcXyz` and the new was `_abcXyz` (meaning I wanted to change the case of the first character after the initial "m" to be lower). The result was: Find: `\b(m)([A-Z])([A-Za-z0-9_]*)\b` Replace: `_\L$2\E$3` Note the `\E` after the first character has been converted to lower case in the replacement expression. – open-collar Sep 01 '16 at 14:38