Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Help with a regular expression

  • 28-12-2007 6:18pm
    #1
    Closed Accounts Posts: 324 ✭✭


    Hi
    Please help

    This is my regular expression:
    \$(\d*?)(\.*?)(\d*?)

    (a dollar, followed by 0 or more digits, followed by ., followed by 0 or more digits).

    I just need to check that the string is no longer than say 8 characters long, including the numbers, . and dollar sign.

    I know how to restrict the length of any string to 8 letters
    ^.{1,8}$
    but I'm having trouble combing this with the first expression


    Help!:D


Comments

  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    ^\$[0-9]{0,2}$

    Start from that


  • Closed Accounts Posts: 324 ✭✭radioactiveman


    This seems to be working :

    ^[\$(\d*?)(\.*?)(\d*?)]{1,8}$

    The square brackets make the difference, I'll have to look this up:confused:


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    The square brackets are groupings, you should probably have one for each side of the decimal.


Advertisement