Besides the flags of the RegexOptions compiler, there is no direct equivalent for the /s modifier style, but you can get the same effect by placing the built-in modifier at the very beginning of your regular expression:
"(?s)A(.*?)B"
Remember that there are two forms of the built-in modifier. The one you used in your example:
"A(?s)(.*?)(?-s)B"
... does not have a colon. (?s) is just a switch that turns on DOTALL mode until (?-s) turns it off again. Another version with a colon is actually not an exciting group (?:...) with a built-in mode switch. The mode switch is only effective when part of the regular expression within this group is in control. Using this version, your example will become
"A(?s:.*?)B"
... or if you still want to use a capture group:
"A(?s:(.*?))B"
You do not want to mix the two versions. If you were to write your original regular expression as follows:
"A(?s:)(.*?)(?-s:)B"
... it will not throw an exception, but it will not work as intended. (?s:) there will simply be nothing in DOTALL mode, but (?-s:) will no longer correspond in DOTALL mode.
source share