...

View Full Version : regular expresions question



kwhubby
02-24-2003, 03:31 AM
hi I am trieng to find a word in a list of words like this
cow
frog
sheep
bigsheep
bigsheepy
donky
cat
bannah
apple
if I was trieng to see if thers a match for sheep I try /\rsheep\r/
yet it returns nothing
the \r is for cariage returns
/sheep\r/ works, but I would also get bigsheep from that list
which I don't want, (also just plane /sheep/ would give me sheep, big sheepy, and big sheep)
Ive also tried using
\b, \B, and \W, but none of them works when I place them before the word I want. regular expresions are pretty new to me, so I need some help

jkd
02-24-2003, 04:02 AM
I don't know if IE supports this, but Javascript 1.5 implementations (such as Mozilla) have a multiline flag:

/^sheep$/m

If you're matching from a textarea, you should probably try:

/\r\nsheep\r\n/

:)

kwhubby
02-24-2003, 04:51 AM
yay :D that worked, thanks!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum