.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Regexp::Common::list 3" .TH Regexp::Common::list 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Regexp::Common::list \-\- provide regexes for lists .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Regexp::Common qw /list/; \& \& while (<>) { \& /$RE{list}{\-pat => \*(Aq\ew+\*(Aq}/ and print "List of words"; \& /$RE{list}{\-pat => $RE{num}{real}}/ and print "List of numbers"; \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Please consult the manual of Regexp::Common for a general description of the works of this interface. .PP Do not use this module directly, but load it via \fIRegexp::Common\fR. .ie n .SS """$RE{list}{\-pat}{\-sep}{\-lastsep}""" .el .SS \f(CW$RE{list}{\-pat}{\-sep}{\-lastsep}\fP .IX Subsection "$RE{list}{-pat}{-sep}{-lastsep}" Returns a pattern matching a list of (at least two) substrings. .PP If \f(CW\*(C`\-pat=\fR\f(CIP\fR\f(CW\*(C'\fR is specified, it defines the pattern for each substring in the list. By default, \fIP\fR is \f(CW\*(C`qr/.*?\eS/\*(C'\fR. In Regexp::Common 0.02 or earlier, the default pattern was \f(CW\*(C`qr/.*?/\*(C'\fR. But that will match a single space, causing unintended parsing of \f(CW\*(C`a, b, and c\*(C'\fR as a list of four elements instead of 3 (with \f(CW\*(C`\-word\*(C'\fR being \f(CW\*(C`(?:and)\*(C'\fR). One consequence is that a list of the form "a,,b" will no longer be parsed. Use the pattern \f(CW\*(C`qr /.*?/\*(C'\fR to be able to parse this, but see the previous remark. .PP If \f(CW\*(C`\-sep=\fR\f(CIP\fR\f(CW\*(C'\fR is specified, it defines the pattern \fIP\fR to be used as a separator between each pair of substrings in the list, except the final two. By default \fIP\fR is \f(CW\*(C`qr/\es*,\es*/\*(C'\fR. .PP If \f(CW\*(C`\-lastsep=\fR\f(CIP\fR\f(CW\*(C'\fR is specified, it defines the pattern \fIP\fR to be used as a separator between the final two substrings in the list. By default \fIP\fR is the same as the pattern specified by the \f(CW\*(C`\-sep\*(C'\fR flag. .PP For example: .PP .Vb 4 \& $RE{list}{\-pat=>\*(Aq\ew+\*(Aq} # match a list of word chars \& $RE{list}{\-pat=>$RE{num}{real}} # match a list of numbers \& $RE{list}{\-sep=>"\et"} # match a tab\-separated list \& $RE{list}{\-lastsep=>\*(Aq,\es+and\es+\*(Aq} # match a proper English list .Ve .PP Under \f(CW\*(C`\-keep\*(C'\fR: .ie n .IP $1 4 .el .IP \f(CW$1\fR 4 .IX Item "$1" captures the entire list .ie n .IP $2 4 .el .IP \f(CW$2\fR 4 .IX Item "$2" captures the last separator .ie n .SS """$RE{list}{conj}{\-word=\fIPATTERN\fP}""" .el .SS \f(CW$RE{list}{conj}{\-word=\fP\f(CIPATTERN\fP\f(CW}\fP .IX Subsection "$RE{list}{conj}{-word=PATTERN}" An alias for \f(CW\*(C`$RE{list}{\-lastsep=>\*(Aq\es*,?\es*\fR\f(CIPATTERN\fR\f(CW\es*\*(Aq}\*(C'\fR .PP If \f(CW\*(C`\-word\*(C'\fR is not specified, the default pattern is \f(CW\*(C`qr/and|or/\*(C'\fR. .PP For example: .PP .Vb 2 \& $RE{list}{conj}{\-word=>\*(Aqet\*(Aq} # match Jean, Paul, et Satre \& $RE{list}{conj}{\-word=>\*(Aqoder\*(Aq} # match Bonn, Koln oder Hamburg .Ve .ie n .SS """$RE{list}{and}""" .el .SS \f(CW$RE{list}{and}\fP .IX Subsection "$RE{list}{and}" An alias for \f(CW\*(C`$RE{list}{conj}{\-word=>\*(Aqand\*(Aq}\*(C'\fR .ie n .SS """$RE{list}{or}""" .el .SS \f(CW$RE{list}{or}\fP .IX Subsection "$RE{list}{or}" An alias for \f(CW\*(C`$RE{list}{conj}{\-word=>\*(Aqor\*(Aq}\*(C'\fR .SH "SEE ALSO" .IX Header "SEE ALSO" Regexp::Common for a general description of how to use this interface. .SH AUTHOR .IX Header "AUTHOR" Damian Conway (damian@conway.org) .SH MAINTENANCE .IX Header "MAINTENANCE" This package is maintained by Abigail (\fIregexp\-common@abigail.be\fR). .SH "BUGS AND IRRITATIONS" .IX Header "BUGS AND IRRITATIONS" Bound to be plenty. .PP For a start, there are many common regexes missing. Send them in to \fIregexp\-common@abigail.be\fR. .SH "LICENSE and COPYRIGHT" .IX Header "LICENSE and COPYRIGHT" This software is Copyright (c) 2001 \- 2017, Damian Conway and Abigail. .PP This module is free software, and maybe used under any of the following licenses: .PP .Vb 4 \& 1) The Perl Artistic License. See the file COPYRIGHT.AL. \& 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2. \& 3) The BSD License. See the file COPYRIGHT.BSD. \& 4) The MIT License. See the file COPYRIGHT.MIT. .Ve