Hello monks,
I have a file that looks something like this:
<TABLE name="table1">
FieldName1 VARCHAR(20)
FieldName2 INT(20)
FieldName3 BOOL
</TABLE>
<TABLE name="table"2>
FieldName1 VARCHAR(20)
FieldName2 INT(20)
FieldName3 BOOL
</TABLE>
Now I expect to be able to say:
while ($file =~ s/<TABLE(.*)>([\n.]*)<\/TABLE>//i)
{
# $1 should equal ' name="table1"'
my $attributes = $1;
#$2 should equal
#
#FieldName1 VARCHAR(20)
#FieldName2 INT(20)
#FieldName3 BOOL
#
my $fields = $2;
}
What I get is nothing. When I say
$file =~ s/<TABLE(.*)>(\n.*)//i
Then
$2 = 'FieldName1 VARCHAR(20)'
- the first line of text. Or:
$file =~ s/<TABLE(.*)>([\n.]*)//i\
Then
$2 = "\n";
I know that the . (wildcard) charcater doesn't match newlines, hence using the character class \n. in my original example - does anyone have an answer as to why this doesn't work, and what should I do instead?
Thank you!