PowerShell – Case-insensitive String Replacement

The problem: Replace "a" with "b" case-insensitively You have a simple string and you want to replace all "a" with "b" in a case-insensitive manner. First attempt (fail): PS C:\Windows\system32> [string] $someString = 'aAaAaAaA' $SomeString.Replace('a', 'b') #Result bAbAbAbAbA What happened? The [string].Replace() method is case-sensitive Second attempt (looks like it works but not quite): PS … Continue reading PowerShell – Case-insensitive String Replacement

Advertisements

Oracle – Find Hard-coded Dates In PL/SQL Code Using Regular Expressions

Recently a situation came up in PL/SQL code where the format specifier for date was misplaced. Oracle did not complain because it can implicitly convert strings to date. It may not even fail at run-time under most circumstances (always recommend using an explicit format specification though). This is the SQL ..but the Developer meant this: … Continue reading Oracle – Find Hard-coded Dates In PL/SQL Code Using Regular Expressions