Using Regular Expressions to change case

You can change the case of text with Regular Expressions in some applications and programming languages by placing control strings in the replacement expression indicating the type of conversion you want.

NOTE: The following examples were tested in BBEdit which has a great grep search/replace functionality and which uses \ to indicate capture groups rather than $ as is common in other RegEx implementations.

  • \U: Start converting all letters to uppercase. Ex:
    • Source text: Hello World
    • Selection RegEx: (Hello) World
    • Replacement: \U\1 World
    • Final value: HELLO WORLD
    • Comments: Notice \U starts uppercase conversion and affects all text following it, regardless of the capture group.
  • \L: Start converting all letters to lowercase. Ex:
    • Source text: Hello World
    • Selection RegEx: Hello World
    • Replacement: \LHello World
    • Final value: hello world
    • Comments: With or Without capture groups, the case control string \L affects all text that follows it.
  • \E: End most recent conversion setting. Only necessary if you're not using additional control strings to change text case, but wish to stop the initial conversion at some point before the end of the replacement string.
    • Example 1:
      • Source text: hEllo FuNnY WorlD
      • Selection RegEx: ([a-zA-Z]*) ([a-zA-Z]*) ([a-zA-Z]*)
      • Replacement: \U\1 \2 \3
      • Final value: HELLO FUNNY WORLD
      • Comments: The initial \U control string converts all characters that follow uppercase.
    • Example 2:
      • Source text: hEllo FuNnY WorlD
      • Selection RegEx: ([a-zA-Z]*) ([a-zA-Z]*) ([a-zA-Z]*)
      • Replacement: \U\1 \L\2 \U\3
      • Final value: HELLO funny WORLD
      • Comments: We set a conversion control character before each capture group, resetting the conversion that takes place.
    • Example 3:
      • Source text: hEllo FuNnY WorlD
      • Selection RegEx: ([a-zA-Z]*) ([a-zA-Z]*) ([a-zA-Z]*)
      • Replacement: \U\1\E \2 \3
      • Final value: HELLO FuNnY WorlD
      • Comments: A \E control string is used after the initial \U\1 (which converts the first capture group to all caps). \E ends the uppercase conversion, leaving capture groups 2 and 3 unaffected by the initial \U.

More complete info at:

Repair Video: MacBook Pro 15, Late 2013 Battery Replacement

For the last 10 years, or so, along with my friend Flavio I've been recording a popular Spanish-language podcast called Puromac, about all things Apple. We also have a YouTube channel which, up until recently, only had videos in Spanish. Well, I recently replaced the battery of my MacBook Pro using an iFixIt kit and made two videos about the experience: one in English and the other in Spanish. Below is the English version for your viewing pleasure:

Fed from Puromac walks us through replacing the battery on his 15" MacBook Pro, Late 2013, using a kit from iFixIt. He also shows an alternate technique for safely removing the battery pack without completely disassembling your MacBook, by using a nylon string and adhesive remover. [English Version]

Repair: Bad Electrolytic Capacitor Strikes Again, This Time In A Refrigerator Control Unit


My Kitchen Aid model KBLC36FMS02 built-in refrigerator had been making odd sounds for a few weeks and then one day stopped cooling. I pulled the fridge out of its niche and eventually pulled out the control board on top of condenser coil. When I Googled some of the numbers on the PCB (ex: "W10219463 control board fix"), I came across the blog of Steve Jenkins, who had an excellent post on the control board issue with all the information I needed to repair it. The problem with my control board came down to a faulty 220uf electrolytic capacitor. And as I learned from my friend Josh when I repaired a 30-year old coffee maker, electrolytic capacitors always go bad.


When my refrigerator, a Kitchen Aid model KBLC36FMS02 started making odd sounds, I ignored it. A few weeks later, when it stopped cooling, I couldn't ignore it.

My first thought was that the compressor had a leaked coolant and no longer worked. I pulled the refrigerator out of its niche and took apart the enclosure on top of the fridge which housed the compressor and condenser coil.

Before taking apart the top housing, I had unplugged the refrigerator. Since I didn't see anything obviously wrong with the compressor, I plugged the fridge back in to see if that might reset the temperature sensors. The compressor started up and I saw frost appear on the output tube, so I guessed that the compressor was working correctly.

Next I took a look at the condenser coils. I thought that maybe the refrigerator had turned itself off because, if the coils were sufficiently dirty, the fridge couldn't release heat. The coils were filthy, having never been cleaned in the 10 years since the fridge had been in operation.

Dirty condenser coils

I cleaned out the coils and started up the fridge again, but it was clear after a few minutes that it still wasn't cooling. That's when I noticed that the condenser coil fan wasn't spinning. So, my next guess as to what was wrong with the fridge was that the control board, which I could see above the condenser coils, had a problem with it. I removed the board and took a look at it.

From my experience fixing a 30-year old coffee maker I learned that electrolytic capacitors often go bad. However, the capacitors on the board didn't look damaged or have any discharge like the ones I replaced in my old coffee maker.

I Googled the numbers on the PCB of the control board, hoping to find if I could find a replacement board and how much it would cost. Ebay had several services that would either sell you a new board ($850!!) or repair existing boards ($70-$200).

Then I came across Steve Jenkins' blog which had a post about the very control unit I was researching. Steve's post is excellent, with lots of useful information, including the fact that the failure condition I was experiencing is a well-known issue with the control board (model W10219463), and that two parts in particular fail on the board: a relay and an electrolytic capacitor.

From Steve's blog I learned that the single 200uf capacitor on the board is the one to go bad and when I looked at it again, I noticed that even though there was no discharge from the capacitor, its top was bulging, just like Steve described.

Bulging capacitor top

I removed the bad capacitor and tested it, confirming that it did not hold anywhere near the charge it was supposed to. 

Low capacity on bad capacitor

So, I replaced the bad 220uf capacitor with a fresh one, reinstalled the control board and started up the refrigerator. The compressor went on as did the fan! After a few minutes I confirmed that the fridge was cooling again.