trouble with regular exp.

Light Poster
21Jul2011,21:47   #1
newbie_10's Avatar
define F0_FN_C_B 0800 4:0 s_x_f_c 0800 gg 09 F_C_BL

this is a line from a file and I want to extract the last column in the line which is in this case 'F_C_BL'

how do I do that?
Go4Expert Member
25Jul2011,18:53   #2
vikky1988i's Avatar
The Line which u have mentioned :
define F0_FN_C_B 0800 4:0 s_x_f_c 0800 gg 09 F_C_BL

Considering/ Assuming before the sub-string (F_C_BL) , there will be a 2 digit number followed by a space , i write this regular expression.

[\w\W\s*]\d\d\s([A-Za-z0-9]+)\s*\-([A-Za-z0-9]+)\s*\-([A-Za-z0-9]+)\s*

I think the above regex will work fine....Thank you.


newbie_10 like this
Light Poster
3Aug2011,12:39   #3
ansh batra's Avatar
$a='F0_FN_C_B 0800 4:0 s_x_f_c 0800 gg 09 F_C_BL';
$a=~/.*\d\d /;
print "$'\n";
same asumptions
Team Leader
30Aug2011,13:48   #4
pradeep's Avatar
Code: Perl
my $a = 'F0_FN_C_B 0800 4:0 s_x_f_c 0800 gg 09 F_C_BL';
$a =~ /(\S+)$/;
print "$1\n";