 |
|
Home:
Perl Programming Help:
Regular Expressions:
HELP!!Regex to match boundary from a range and substitute characters:
Edit Log
|
|

akshay34
New User
Sep 17, 2012, 10:05 AM
Views: 2093
|
|
HELP!!Regex to match boundary from a range and substitute characters
|
|
|
Hi guys I am a beginner and I need help with this problem. I am trying to this question. Search for all names which second character of their first name is in the range of a-i. And it will substitute all beginning L’s with Z’s. The file is entered into an empty array from the command line. My problem is that I cant seem to devise a way to get the proper regex into the if statement. Here is the code i have so far. Here is the file containing text that is read into the empty array. Joshua Smith John Jenkins Larry Roberts Bob Jones Linda Green Tim Anderson Adam Jackson
#!/usr/bin/perl @phone = (<>); foreach $item (@phone) { if ($item =~ /([a-i])\b/) { print $item; } } Thanks for any help in advance =)
(This post was edited by akshay34 on Sep 17, 2012, 10:06 AM)
|
|
|
Edit Log:
|
|
Post edited by akshay34
(New User) on Sep 17, 2012, 10:06 AM
|
|
Post edited by akshay34
(New User) on Sep 17, 2012, 10:06 AM
|
|
|  |