79626135

Date: 2025-05-17 03:21:57
Score: 0.5
Natty:
Report link

I think the most convenient answer (besides the mode modifier (?i) above) which is case-insensitive and also will match multiple times on a single line (-Match will not) (https://stackoverflow.com/a/24190283/4582204) is:

$string = 'A1B_A2B'
$regex = 'a.b'
$flags = 'IgnoreCase'
[regex]::matches($string, $regex, $flags) | ft

or simply:

[regex]::match('A1B_A2B', 'a.b', 'IgnoreCase') | ft

Which returns a 2-element array (really a MatchCollection):

Groups Success Name Captures Index Length Value
------ ------- ---- -------- ----- ------ -----
{0}       True 0    {0}          0      3 A1B  
{0}       True 0    {0}          4      3 A2B  
Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: john v kumpf