in reply to Re: Steps to get a substring from a string
in thread Steps to get a substring from a string
How about the 2nd case,2) I have name=servername , i want to still capture the first part in a variable. In this your code will not work. we need to match a-zA-Z character after =
Update:my $str='name=host.com' my ($match) =$string=~/=([a-zA-Z]+)/;
Updated the regex part as per CountZero's node Re^3: Steps to get a substring from a string
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Steps to get a substring from a string
by CountZero (Bishop) on Jul 21, 2015 at 17:05 UTC | |
by vinoth.ree (Monsignor) on Jul 21, 2015 at 17:10 UTC |