Those are modifiers, which will set an option in the regex that will result in a certain effect.

I'm too lazy to list/explain all of them, so I took them from tidy_trax's Wildcards & Regular Expressions tutorial:
  • /A
    This can be used instead of putting a ^ at the start of your expression.

    //echo -a $regex(abc, /a/A) will echo '1' because the string started with 'a'
  • /g
    This makes the regular expression match all matches instead of just one.

    //echo -a $regex(aaa, /\w/g) will echo '3' because it matched all 3 as.
  • /i
    This makes the regular expression case-insensitive.

    //echo -a $regex(A, /a/i) will return '1' because it no longer cares about the case of whatever it's matching.
  • /m
    This will make ^ match the start of a newline (\n or $lf) as well as the start of a string and $ match the end of a line (\r or $cr) as well as the end of a string.

    //echo -a $regex($crlf, /^$/m) will echo '1' because when the /m modifier is used ^ will match a linefeed and $ will match a carriage return.
  • /s
    This means that '.' will match any character, including newlines.

    //echo -a $regex($lf, /./s) will echo '1' because '.' now matches newlines too.
  • /S
    This will strip control codes from the string before performing a match.

    //echo -a $regex(04a, /./gS) will echo '1' because after stripping "04" from the string it only found one character.
  • /U
    This reverses the behaviour of greediness (see the "greediness" section)

    //echo -a $regex(1234, /\d+/U) will match '1' the + quantifier is no longer greedy.
  • /x
    This will ignore all spaces from your pattern except for those between \Q and \E or { and }, it also allows you to enclose comments within # and # in your expression.

    //echo -a $regex(ab, /^a #this is a comment# b$/x) will echo '1' as the /x modifier removes all spaces from your pattern so it becomes equivalent to /^ab$/
  • /X
    This will return 0 if you use \ that doesn't have a special meaning.

    //echo -a $regex(\y, /\y/X) will echo '0' as \y has no special meaning.


Gone.