![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search for string in a file and extract another string to a variable | daikeyang | Shell Programming and Scripting | 6 | 03-20-2009 08:45 PM |
| extract a string from main string | madhu.it | Shell Programming and Scripting | 1 | 10-06-2008 04:05 AM |
| extract a sub string from a main string | madhu.it | Shell Programming and Scripting | 5 | 10-04-2008 02:22 AM |
| perl newbie: how to extract an unknown word from a string | wolwy_pete | Shell Programming and Scripting | 3 | 03-23-2008 10:41 AM |
| How to extract a portion of a string from the whole string | ds_sastry | UNIX for Dummies Questions & Answers | 2 | 09-29-2001 10:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Perl Extract String
Hi,
I have a string like "something is good wanted (bla bla)" I need to get the world "wanted" from this string and "assign it to a variable".. but it's not a static word so i want to get that word by searching the pattern as follows <space>desiredword<space>( and i tried to get that word by Code:
$string =~ m/\s.*?\s\(/gi; Many thanks in advance.. Last edited by Yogesh Sawant; 07-05-2009 at 10:19 AM.. Reason: added code tags |
|
||||
|
try this
Code:
my $s = "something is good wanted (bla bla)";
if ( $s =~ /^.*\s(.*)\s\(/ ) {
print "$1";
}
Last edited by Yogesh Sawant; 07-05-2009 at 10:18 AM.. Reason: added code tags |
| Sponsored Links | ||
|
|