use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr![^/]+(?=/$)! )->explain; __END__ The regular expression: (?-imsx:[^/]+(?=/$)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- [^/]+ any character except: '/' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- (?= look ahead to see if there is: ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of look-ahead ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr![^/]+(?=/)$! )->explain; __END__ The regular expression: (?-imsx:[^/]+(?=/)$) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- [^/]+ any character except: '/' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- (?= look ahead to see if there is: ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- ) end of look-ahead ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
In reply to Re: regex issue (positive look-ahead)
by Anonymous Monk
in thread regex issue (positive look-ahead)
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |