FishMonger
Veteran
/ Moderator
Nov 30, 2013, 6:19 AM
Post #4 of 10
(41351 views)

Re: [cybex] Syntax for string variances in Perl
[In reply to]

Can't Post


#!/usr/bin/perl use strict; use warnings; use YAPE::Regex::Explain; my $regex = 'm/^\s*\(?SUBJECT\)*\s*\d{0,2}\)*\s*:*\s*\s{2}\(?S\)*\d{0,2}\)*\s*:*\s*/'; print YAPE::Regex::Explain>new($regex)>explain();
c:\test>explainregex.pl The regular expression: (?imsx:m/^\s*\(?SUBJECT\)*\s*\d{0,2}\)*\s*:*\s*\s{2}\(?S\)*\d{0,2}\)*\s*:*\s*/) matches as follows: NODE EXPLANATION  (?imsx: group, but do not capture (casesensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally):  m/ 'm/'  ^ the beginning of the string   OR  \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible))  \(? '(' (optional (matching the most amount possible))  SUBJECT 'SUBJECT'  \)* ')' (0 or more times (matching the most amount possible))  \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible))  \d{0,2} digits (09) (between 0 and 2 times (matching the most amount possible))  \)* ')' (0 or more times (matching the most amount possible))  \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible))  :* ':' (0 or more times (matching the most amount possible))  \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible))   OR  \s{2} whitespace (\n, \r, \t, \f, and " ") (2 times)  \(? '(' (optional (matching the most amount possible))  S 'S'  \)* ')' (0 or more times (matching the most amount possible))  \d{0,2} digits (09) (between 0 and 2 times (matching the most amount possible))  \)* ')' (0 or more times (matching the most amount possible))  \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible))  :* ':' (0 or more times (matching the most amount possible))  \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible))   OR  / '/'  ) end of grouping 
(This post was edited by FishMonger on Nov 30, 2013, 6:20 AM)
