LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   perl: substring extraction after specific char (https://www.linuxquestions.org/questions/programming-9/perl-substring-extraction-after-specific-char-32035/)

markus1982 10-06-2002 05:06 AM

perl: substring extraction after specific char
 
How to get /usr/lib/libdns.so.5 out of

Code:

        libdns.so.5 => /usr/lib/libdns.so.5 (0x40026000)

acid_kewpie 10-06-2002 05:34 AM

Code:

$string=~/.+=>\s(.+)\s\(.+/;
print $1;

should do the trick, although you've not said how flexible the string is. i.e. which bits will always be there to compare against. read the regex page for more information "perldoc perlre". read through there and try to write out the regex i've written in a more long hand form.

Can i side track you for a minute and ask why you've said "How to get..." rather than "How can i get..." or "How do i get..." etc...? 9/10 non-english people seem to say that when asking a question. Does it make more sense to say what you have in a literal translation to german or other languages? thanks.

markus1982 10-06-2002 05:48 AM

First of all thanks for your reply. Really have to check up on perl regular expressions ;)

As for the side question, depends on the time, mood, etc somehow in which way at least I ask questions. Can't give you a real answer on that - sorry ;)


All times are GMT -5. The time now is 07:35 AM.