Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegExp Alternative 1

Status
Not open for further replies.

biobrain

MIS
Jun 21, 2007
90
GB
For my data

A2BD05 NEK6_PIG Serine/threonine-protein kinase Nek6 - Sus scrof... 129 1e-29

i am using this RegExp and it is working for me to print the last two column

Code:
print "$1\n" if $line =~ /^......................................................................(...........)/;

Is there any alternate to this so that my RegExp can be more professional.
 
Are the columns fixed-width or is there a delimiter of some kind between the columns?
 
Since you're not actually matching a pattern, there's no need for a regexp at all. You're simply counting characters from the start of the string, so "substr" is the way to go:
Code:
print substr( $line, 70, 11 ), "\n";

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top