Regular Expression To Match Bed Format
I see a TAB delimited parser, but I have to be restrict on the first three columns (chr, start, end), and since the rest of the columns are optional, they might not be available in the data at all.
I came up with: [^\t]+\t\d+\t\d+\t?.|[^\t]+\t\d+\t\d+$
However I'm not really convinced by myself.
Any better suggestions?
• 2,833 views
•
link
0 answers
No answers yet.
Log in to answer this question.
I think your regex is OK. You could insert a '^' as the first character to match the beginning of the line.
@Pierre, good point, cheers.
If it's perl you might just use something like ($chr, $start, $end) = split /t/;