in reply to Regex matching next occurrence or to the end of line.
I am not completely sure what you want to achieve but using split capturing the separators using parentheses could help here:
use strict; use warnings; use Data::Dumper; my $string_exp = 'something in this string is a number. ${=NumberForma +t "99999999"} is a number. And another ${=CharFormat "X*"} is ${=Numb +erFormat "9+"}.'; my @pieces = split /(\$\{.*?\})/, $string_exp; print Dumper \@pieces;
gives you
$VAR1 = [ 'something in this string is a number. ', '${=NumberFormat "99999999"}', ' is a number. And another ', '${=CharFormat "X*"}', ' is ', '${=NumberFormat "9+"}', '.' ];
and the following if the curly brace is missing:
$VAR1 = [ 'something in this string is a number. ', '${=NumberFormat "99999999"}', ' is a number. And another ', '${=CharFormat "X*"}', ' is $=NumberFormat "9+"}.' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex matching next occurrence or to the end of line.
by nabeenj (Initiate) on Feb 05, 2015 at 10:12 UTC |