diff options
| author | Teddy Wing | 2021-08-18 01:17:58 +0200 |
|---|---|---|
| committer | Teddy Wing | 2021-08-18 01:17:58 +0200 |
| commit | ea3260541f81be7b288c20da920084271625b1a3 (patch) | |
| tree | 8ae896b4aca84f24b1cb66de18f64f98c5db6848 | |
| parent | ea7e5214410ddb0ed53ccc27aed838a9c846e922 (diff) | |
| download | readline-incdec-ea3260541f81be7b288c20da920084271625b1a3.tar.bz2 | |
Test regex replacement starting from a given position
Set `pos()` to enable us to increment a number in the middle of a
string.
| -rw-r--r-- | pos.pl | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -0,0 +1,11 @@ +#!/usr/bin/env perl -w + +use strict; + +my $test = 'test 12 0 45'; + +$test =~ /(\d+)/g; +pos($test) = 7; +$test =~ s/\G([^\d]*)(\d+)/$1 . ($2 + 1)/e; + +print "$test\n"; |
