1Regexp::Common::delimitUesde(r3)Contributed Perl DocumenRteagteixopn::Common::delimited(3)
2
3
4

NAME

6       Regexp::Common::delimited -- provides a regex for delimited strings
7

SYNOPSIS

9           use Regexp::Common qw /delimited/;
10
11           while (<>) {
12               /$RE{delimited}{-delim=>'"'}/  and print 'a \" delimited string';
13               /$RE{delimited}{-delim=>'/'}/  and print 'a \/ delimited string';
14           }
15

DESCRIPTION

17       Please consult the manual of Regexp::Common for a general description
18       of the works of this interface.
19
20       Do not use this module directly, but load it via Regexp::Common.
21
22   $RE{delimited}{-delim}{-cdelim}{-esc}
23       Returns a pattern that matches a single-character-delimited substring,
24       with optional internal escaping of the delimiter.
25
26       When "-delim =" S> is specified, each character in the sequence S is a
27       possible delimiter. There is no default delimiter, so this flag must
28       always be specified.
29
30       By default, the closing delimiter is the same character as the opening
31       delimiter. If this is not wanted, for instance, if you want to match a
32       string with symmetric delimiters, you can specify the closing
33       delimiter(s) with "-cdelim =" S>. Each character in S is matched with
34       the corresponding character supplied with the "-delim" option. If the
35       "-cdelim" option has less characters than the "-delim" option, the last
36       character is repeated as often as necessary. If the "-cdelim" option
37       has more characters than the "-delim" option, the extra characters are
38       ignored.
39
40       If "-esc =" S> is specified, each character in the sequence S is the
41       delimiter for the corresponding character in the "-delim=S" list.  The
42       default escape is backslash.
43
44       For example:
45
46          $RE{delimited}{-delim=>'"'}               # match "a \" delimited string"
47          $RE{delimited}{-delim=>'"'}{-esc=>'"'}    # match "a "" delimited string"
48          $RE{delimited}{-delim=>'/'}               # match /a \/ delimited string/
49          $RE{delimited}{-delim=>q{'"}}             # match "string" or 'string'
50          $RE{delimited}{-delim=>"("}{-cdelim=>")"} # match (string)
51
52       Under "-keep" (See Regexp::Common):
53
54       $1  captures the entire match
55
56       $2  captures the opening delimiter
57
58       $3  captures delimited portion of the string
59
60       $4  captures the closing delimiter
61
62   $RE{quoted}{-esc}
63       A synonym for "$RE {delimited} {-delim => q {'"`}} {...}".
64
65   $RE {bquoted} {-esc}
66       This is a pattern which matches delimited strings, where the delimiters
67       are a set of matching brackets. Currently, this comes 85 pairs. This
68       includes the 60 pairs of bidirection paired brackets, as listed in
69       <http://www.unicode.org/Public/UNIDATA/BidiBrackets.txt>.
70
71       The other 25 pairs are the quotation marks, the double quotation marks,
72       the single and double pointing quoation marks, the heavy single and
73       double commas, 4 pairs of top-bottom parenthesis and brackets, 9 pairs
74       of presentation form for vertical brackets, and the low paraphrase,
75       raised omission, substitution, double substitution, and transposition
76       brackets.
77
78       In a future update, pairs may be added (or deleted).
79
80       This pattern requires perl 5.14.0 or higher.
81
82       For a full list of bracket pairs, inspect the output of
83       "Regexp::Common::delimited::bracket_pair ()", which returns a list of
84       two element arrays, each holding the Unicode names of matching pair of
85       delimiters.
86
87       The "{-esc => S }" works as in the "$RE {delimited}" pattern.
88
89       If "{-keep}" is given, the following things will be captured:
90
91       $1  captures the entire match
92
93       $2  captures the opening delimiter
94
95       $3  captures delimited portion of the string
96
97       $4  captures the closing delimiter
98

SEE ALSO

100       Regexp::Common for a general description of how to use this interface.
101

AUTHOR

103       Damian Conway (damian@conway.org)
104

MAINTENANCE

106       This package is maintained by Abigail (regexp-common@abigail.be).
107

BUGS AND IRRITATIONS

109       Bound to be plenty.
110
111       For a start, there are many common regexes missing.  Send them in to
112       regexp-common@abigail.be.
113
115       This software is Copyright (c) 2001 - 2017, Damian Conway and Abigail.
116
117       This module is free software, and maybe used under any of the following
118       licenses:
119
120        1) The Perl Artistic License.     See the file COPYRIGHT.AL.
121        2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.
122        3) The BSD License.               See the file COPYRIGHT.BSD.
123        4) The MIT License.               See the file COPYRIGHT.MIT.
124
125
126
127perl v5.28.0                      2017-06-02      Regexp::Common::delimited(3)
Impressum