Solved

exact word match

Posted on 2000-04-06
1
167 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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