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
24 Returns a pattern that matches a single-character-delimited substring,
25 with optional internal escaping of the delimiter.
26
27 When "-delim=S" is specified, each character in the sequence S is a
28 possible delimiter. There is no default delimiter, so this flag must
29 always be specified.
30
31 If "-esc=S" is specified, each character in the sequence S is the
32 delimiter for the corresponding character in the "-delim=S" list. The
33 default escape is backslash.
34
35 For example:
36
37 $RE{delimited}{-delim=>'"'} # match "a \" delimited string"
38 $RE{delimited}{-delim=>'"'}{-esc=>'"'} # match "a "" delimited string"
39 $RE{delimited}{-delim=>'/'} # match /a \/ delimited string/
40 $RE{delimited}{-delim=>q{'"}} # match "string" or 'string'
41
42 Under "-keep" (See Regexp::Common):
43
44 $1 captures the entire match
45
46 $2 captures the opening delimiter (provided only one delimiter was
47 specified)
48
49 $3 captures delimited portion of the string (provided only one delim‐
50 iter was specified)
51
52 $4 captures the closing delimiter (provided only one delimiter was
53 specified)
54
55 $RE{quoted}{-esc}
56
57 A synonym for $RE{delimited}{q{-delim='"`}{...}}
58
60 Regexp::Common for a general description of how to use this interface.
61
63 Damian Conway (damian@conway.org)
64
66 This package is maintained by Abigail (regexp-common@abigail.nl).
67
69 Bound to be plenty.
70
71 For a start, there are many common regexes missing. Send them in to
72 regexp-common@abigail.nl.
73
75 Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
76 This module is free software. It may be used, redistributed
77 and/or modified under the terms of the Perl Artistic License
78 (see http://www.perl.com/perl/misc/Artistic.html)
79
80
81
82perl v5.8.8 2003-03-23 Regexp::Common::delimited(3)