I'm trying to match a slightly variable pattern and I don't get the point what I'm doing wrong. My pattern looks like this:
u70475_s_at<MAYBE_WHITESPACE><TAB>Mus musculus p45 NF-E2 related factor 2 NRF2 gene exon 2 to exon 5 and complete cds.<MAYBE_WHITESPACE><TAB>2326<MAYBE_TAB>727.3
The second number is optional, numbers can be float or integer.
I try to match the pattern like that:
$_[0] =~ m/([a-zA-Z0-9\-\_\/\.\,]+) \s*\t (.+) \s*\t ([0-9\.]+) \t* ([0-9\.]+)*/;
It works all fine, until I get a line with two numbers, in this case the first number (which I want in $3) is in $2 together with the text ((.+)). The 2nd number is in $3 then.
When I change the last /t* to /t both numbers are matched the way I want ($3 and $4) but lines with only one number are not matched at all ($1-$4 undef).
What's wrong here? Any hints are welcome.
Thanx, Micha
In reply to Pattern matching with \t by professa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |