Sha256: c7898512f90e6d49917e4ba80a8cdbccbebfb2995d589f85195325d61cab2736

Contents?: true

Size: 1.5 KB

Versions: 42

Compression:

Stored size: 1.5 KB

Contents

#! /usr/bin/env perl

use strict;
use warnings;

# common delimiters
print "a: ";
my $a = "foo";
print $a, " - ";
$a =~ s/foo/bar/;
print $a, "\n";

print "b: ";
my $b = "foo";
print $b, " - ";
$b =~ s!foo!bar!;
print $b, "\n";

print "c: ";
my $c = "foo";
print $c, " - ";
$c =~ s@foo@bar@;
print $c, "\n";

print "d: ";
my $d = "foo";
print $d, " - ";
$d =~ s\foo\bar\;
print $d, "\n";

print "\n";

# balanced delimiters
print "e: ";
my $e = "foo";
print $e, " - ";
$e =~ s{foo}{bar};
print $e, "\n";

print "f: ";
my $f = "foo";
print $f, " - ";
$f =~ s(foo)(bar);
print $f, "\n";

print "g: ";
my $g = "foo";
print $g, " - ";
$g =~ s<foo><bar>;
print $g, "\n";

print "h: ";
my $h = "foo";
print $h, " - ";
$h =~ s[foo][bar];
print $h, "\n";

print "\n";

# balanced delimiters with whitespace
print "i: ";
my $i = "foo";
print $i, " - ";
$i =~ s{foo} {bar};
print $i, "\n";

print "j: ";
my $j = "foo";
print $j, " - ";
$j =~ s<foo>		<bar>;
print $j, "\n";

print "k: ";
my $k = "foo";
print $k, " - ";
$k =~
	s(foo)

	(bar);
print $k, "\n";

print "\n";

# mixed delimiters
print "l: ";
my $l = "foo";
print $l, " - ";
$l =~ s{foo} <bar>;
print $l, "\n";

print "m: ";
my $m = "foo";
print $m, " - ";
$m =~ s(foo) !bar!;
print $m, "\n";

print "n: ";
my $n = "foo";
print $n, " - ";
$n =~ s[foo] $bar$;
print $n, "\n";

print "\n";

# /x modifier
print "o: ";
my $o = "foo";
print $o, " - ";
$o =~ s{
				foo
			 } {bar}x;
print $o, "\n";

print "p: ";
my $p = "foo";
print $p, " - ";
$p =~ s%
  foo
  %bar%x;
print $p, "\n";

Version data entries

42 entries across 42 versions & 5 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/pygments.rb-0.6.3/vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.6.3 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.6.2 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.6.1 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.6.0 vendor/pygments-main/tests/examplefiles/perl_regex-delims
mortar-pygments.rb-0.5.7 vendor/pygments-main/tests/examplefiles/perl_regex-delims
mortar-pygments.rb-0.5.6 vendor/pygments-main/tests/examplefiles/perl_regex-delims
mortar-pygments.rb-0.5.5 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-jruby-0.5.4.2 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-jruby-0.5.4.1 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-jruby-0.5.4 vendor/pygments-main/tests/examplefiles/perl_regex-delims
gitlab-pygments.rb-0.5.4 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.5.4 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.5.2 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.5.1 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.5.0 vendor/pygments-main/tests/examplefiles/perl_regex-delims
gitlab-pygments.rb-0.3.2 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.4.2 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.4.1 vendor/pygments-main/tests/examplefiles/perl_regex-delims
pygments.rb-0.3.7 vendor/pygments-main/tests/examplefiles/perl_regex-delims