Solved

exact word match

Posted on 2000-04-06
1
168 Views
Last Modified: 2010-05-18
if i have text and want to search through it for a word like this

 while( $text =~ /\s*([^.!?]*\Q$word\E[^.!?]*[.!?])/g ){    

this will, for instance, return
"this is a test"
if i search for "e"

how do i get it to just give me back when its a full word
ie
it will give back
"this e is a test"
if i search for "e"
0
Comment
Question by:boofulls
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 2690185
/\s*([^.!?]*\b\Q$word\E\b[^.!?]*[.!?])/g
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl program to obtain a machine's memory usage 6 22
Perl count the hash for print 4 161
crawling gofundme 4 120
PERL variable conundrum 9 89
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now