SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Regular expression.

    My continuing problem with regular expressions!

    All I am trying to get is the expression must have at least 1 of these [a-z][0-9] in any order etc etc

    Can anyone help?

    this
    Code:
    RegExp(/[a-z][0-9]/)
    didn't work

    Thanks
    Sarah
    Regular user

  2. #2
    SitePoint Enthusiast Analyser's Avatar
    Join Date
    Oct 2002
    Location
    Delft, The Netherlands
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    at least 1 of these [a-z][0-9] in any order
    Still a bit vague, I'm afraid. Do mean you want a letter followed by a digit, and that any number of times? Like a7c6y3?

    In that case the regex
    Code:
    RegExp(/([a-z][0-9])+/)
    would do the trick.

    But maybe you just want any sequence of one or more alphanumeric characters, like aabx83cq9.

    Then the regex
    Code:
    RegExp(/[a-z0-9]+/)
    is more appropriate.

    Hope this helps.
    "A poor programmer is he who blames his tools."
    http://analyser.oli.tudelft.nl/

  3. #3
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    second one was perfect thank you

    I was so close and yet SO far

    Sarah
    Regular user

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    90% of my regex knowledge came from here
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thanks beetle bed time reading - don't think that was one I read before so thank you.

    Sarah
    Regular user


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
  •