in reply to Special Variables in Regular Expression
my ($data_in, $data_out); $data_in = q|<container><a>smile!!! </a><b> smile again!! </b></contai +ner><?query?>|; while ($data_in =~ /<container><a>(.+?)<\/a><b>(.+?)<\/b><\/container> +(<\?query\?>)?/ig) { $data_out = "$2, $1$3 "; #errors here ; #further processing here print $data_out; }
If you put back the second question mark at the end you will get the error:
If you are new to using regular expressions and are on Windows, you can try this free tool: Regex Coach. It will help you see, graphically, how the regex breaks down and will allow you to step through your expression.Use of uninitialized value $3 in concatenation (.) or string at perlmo +nks_700143.pl line 8.
Celebrate Intellectual Diversity
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Special Variables in Regular Expression
by toolic (Bishop) on Jul 25, 2008 at 16:25 UTC | |
|
Re^2: Special Variables in Regular Expression
by fiat (Initiate) on Jul 28, 2008 at 07:10 UTC |