in reply to MUMPS Array Subscripts Parsing Via RegEx

I'm also very intersted in anything you have to say about how (if at all) you can document or comment a Regular Expression, so it at least looks like commented modem noise instead of just modem noise.
See perlre /x modifier.

Also, courtesy of YAPE::Regex::Explain, here is your /^((\^[%A-Za-z\d]+)($|=|\(bunch_of_ugly_subscripts\)))/ with comments:

(?x-ims: # group, but do not capture (disregarding # whitespace and comments) (case-sensitive) # (with ^ and $ matching normally) (with . not # matching \n): ^ # the beginning of the string ( # group and capture to \1: ( # group and capture to \2: \^ # '^' [%A-Za-z\d]+ # any character of: '%', 'A' to 'Z', 'a' # to 'z', digits (0-9) (1 or more times # (matching the most amount possible)) ) # end of \2 ( # group and capture to \3: $ # before an optional \n, and the end of # the string | # OR = # '=' | # OR \( # '(' bunch_of_ugly_su # 'bunch_of_ugly_subscripts' bscripts # \) # ')' ) # end of \3 ) # end of \1 ) # end of grouping
UPDATE: Does this CPAN search help?

Replies are listed 'Best First'.
Re^2: MUMPS Array Subscripts Parsing Via RegEx
by Clovis_Sangrail (Beadle) on May 16, 2012 at 14:31 UTC

    Wow, that module is pretty impressive! It seems like there is a Perl module for just about anything. On a smaller scale, I will try making use of the '/x' modifier and indentation in the future. It seems like there is some danger that, for people like me who do not use Perl often enough to keep from forgetting stuff between usages, the '/x' modifier could add to the confusion as well as clarify the inner workings of the Regex. I think I would sort of feel obligated to (briefly) explain how '/x' allows whitespace and comments in the comments that I add, probably not a bad thing.