1Regexp::Common::delimitUesde(r3)Contributed Perl DocumenRteagteixopn::Common::delimited(3)
2
3
4
6 Regexp::Common::delimited -- provides a regex for delimited strings
7
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
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}{-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 If "-esc=S" is specified, each character in the sequence S is the
31 delimiter for the corresponding character in the "-delim=S" list. The
32 default escape is backslash.
33
34 For example:
35
36 $RE{delimited}{-delim=>'"'} # match "a \" delimited string"
37 $RE{delimited}{-delim=>'"'}{-esc=>'"'} # match "a "" delimited string"
38 $RE{delimited}{-delim=>'/'} # match /a \/ delimited string/
39 $RE{delimited}{-delim=>q{'"}} # match "string" or 'string'
40
41 Under "-keep" (See Regexp::Common):
42
43 $1 captures the entire match
44
45 $2 captures the opening delimiter (provided only one delimiter was
46 specified)
47
48 $3 captures delimited portion of the string (provided only one
49 delimiter was specified)
50
51 $4 captures the closing delimiter (provided only one delimiter was
52 specified)
53
54 $RE{quoted}{-esc}
55 A synonym for $RE{delimited}{q{-delim='"`}{...}}
56
58 Regexp::Common for a general description of how to use this interface.
59
61 Damian Conway (damian@conway.org)
62
64 This package is maintained by Abigail (regexp-common@abigail.be).
65
67 Bound to be plenty.
68
69 For a start, there are many common regexes missing. Send them in to
70 regexp-common@abigail.be.
71
73 This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail.
74
75 This module is free software, and maybe used under any of the following
76 licenses:
77
78 1) The Perl Artistic License. See the file COPYRIGHT.AL.
79 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.
80 3) The BSD Licence. See the file COPYRIGHT.BSD.
81 4) The MIT Licence. See the file COPYRIGHT.MIT.
82
83
84
85perl v5.12.0 2010-01-02 Regexp::Common::delimited(3)