Search notes:

Regular expressions: case sensitivity

Some regular expression dialects (which ones?) allow to explicitly turn on or off case sensitivity in the pattern itself with (?i) or (?-i).

PowerShell example

The following PowerShell example tries to demonstrate the usage of (?) an (?-i).
$regex_case_default    = [regex]::new(     'ab*c')
$regex_case_insensitiv = [regex]::new( '(?i)ab*c')
$regex_case_sensitiv   = [regex]::new('(?-i)ab*c')

$regex_case_default.match(   'xAcd').success # False
$regex_case_insensitiv.match('xAcd').success # True
$regex_case_sensitiv.match(  'xAcd').success # False
See also the System.Text.RegularExpressions.RegexOptions enum.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199475, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/regular-expressions/case-sensitivity(48): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78