Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post

    regular expresions question

    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
    Kris Hubby
    kwhubby site

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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/


  • #3
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    yay that worked, thanks!!
    Kris Hubby
    kwhubby site


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •