Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

binkzz follow up question

Posted on 2000-03-21
2
Medium Priority
?
198 Views
Last Modified: 2010-03-05
hi
u helped me with

http://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=10313986 

i asked for two versions where a word on either the
right or left was matched and shown

this time could u show 5 charcters to the left of the word
and 5 characters to the right of the word?

so if text is
"this is a test that i will test out now for a test run."
and wrd is "test"
i will get
is a test that
will test out
or a test run.

(note 5 characters are displayed on each side of the matched word

thanks
0
Comment
Question by:boofulls
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Expert Comment

by:binkzz
ID: 2639771
#! /usr/bin/perl

$test = "this is a test that i will test out now for a test run.";
$word = "test";

my $templine = $test;


while ($templine =~ m/(.....)$word(.....)/is)
{
  $templine =~ s/(.....)$word(.....)//is;

  print "$1$word$2\n";
}
0
 
LVL 4

Accepted Solution

by:
binkzz earned 400 total points
ID: 2639773
There ya go :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question