regex - Perl - Parse last occurrence of whitespace -



regex - Perl - Parse last occurrence of whitespace -

i trying parse lastly chunk of next line:

77 0 wl1271/wpa_supplicant_lib/driver_ti.h

unfortunately, spaces not same length. assume printf or similar used output info lined in columns. means have spaces, , have tab characters.

i have gotten first 2 numbers through utilize of regex in perl. way thought lastly bit search of lastly occurrence of whitespace character , grab rest of string starting there. tried using rindex accepts character searchable parameter , not regex (i thought \s trick).

can solve issue i'm having here either walking through how lastly whitespace character or helping me solution grab string other way?

why not split?

use strict; utilize warnings; $string = '77 0 wl1271/wpa_supplicant_lib/driver_ti.h'; ( $num1, $num2, $lastpart ) = split ' ', $string; print "$num1\n$num2\n$lastpart";

output:

77 0 wl1271/wpa_supplicant_lib/driver_ti.h

regex perl whitespace filenames

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -