I have this:
var blockRegEx = new Regex("(proc sql;)(.*?)(quit;)", RegexOptions.IgnoreCase |
RegexOptions.Multiline);
but it only works if the string is on a single line.
For example:
proc sql;
create table xtr as
select
midsu_client_id,
prodt_cd,
confmt_ind,
maj_diag_categ,
mbr_num,
pay_amt format=comma16.2
from cr_data.rptng
where &acctnum
and gl_postg between "&date_1" and "&date_2"
;
quit;
RegexOptions.MultiLine changes the behavior of the ‘^’ and ‘$’ characters:
Multiline is useful if you’re passing multiple lines at once into your regex search and you want to treat them as multiple lines (i.e. they all start with ‘^’ and end with ‘$’).
I think you want to try using RegexOptions.SingleLine instead:
SingleLine is useful if you’re passing multiple lines at once into your regex search and you want to treat them as thought they were actually all a single line.