Welcome to TalkGraphics.com
Results 1 to 6 of 6
  1. #1

    Default Regular Expression

    Can anyone help with the correct syntax for a reg expression to match just one word only?

    Im looking to use an alternative to Captcha. A "what colour is the sky?" type question where only one one-word answer will be accepted for form submission.
    i.e. "blue" would be the only correct answer, accepted in upper and lower case


    Yours sincerely suffering from spam,
    Thank You

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,503

    Default Re: Regular Expression

    The opposite of black? Or conversely, the opposite of white.

    The opposite of day? The opposite of night?

  3. #3
    Join Date
    Jan 2006
    Location
    Los Angeles
    Posts
    945

    Default Re: Regular Expression

    I have had success with "what is "1+1"- two.
    Grace
    http://gracehjs.com/
    Xara Software XDP11

  4. #4

    Default Re: Regular Expression

    From google's site the following example is given for hell (it won't return results for part words eg hello, shell which is what I want):
    (\W|^)hell(\W|$)

    but the syntax seems to be wrong, any suggestions?

  5. #5
    Join Date
    Jan 2004
    Location
    Holland Patent, NY, USA
    Posts
    605

    Default Re: Regular Expression

    I believe it is language specific. What are you using? PHP, ASP, ASP.NET, Javascript?

    This site lets you enter an expression, set flags (e.g. case insensitivity), and when you click submit, it tests the expression with the option to display the proper syntax for selected languages.

    http://www.myregextester.com/

  6. #6
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,823

    Default Re: Regular Expression

    Something like \b[Bl][Ll][Uu][Ee]\b

    Acorn

 

 

Bookmarks

Posting Permissions

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