Results 1 to 3 of 3

Thread: Regex and a Social Security #

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2003
    Posts
    89

    Regex and a Social Security #

    I read up on Regular Expressions, can it handle reading through a string and get a social security # after it sees "SSN:"

    So for example, an SSN would look like:

    SSN: 5 5 5 - 5 5 - 5 5 5 5


    I would like to grab all the underlined numbers and display them like this after I see SSN:

    555-55-5555

    Any ideas?

    Chris

  2. #2
    Member
    Join Date
    Feb 2004
    Location
    LA
    Posts
    57
    Hello Trancedified,

    Try this :

    Code:
    If Not Regex.IsMatch(TextBox.Text, "^\s*(\d{3}-\d{2}-\d{4})\s*$") Then
                TextBox.ForeColor = Color.Red
                
            Else
                TextBox.ForeColor = Color.Black
            End If
    Hope this helps

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2003
    Posts
    89
    Wow cool! Would you happen to know how to do a screen scrape of a desktop application?


    (I need a way to extract the social security number, this app doesn't have the copy/paste capabilities, it's very OLD)

    Our client has this application open and doesn't want to write down the SSN on a piece of paper and have to re-enter it in another application.


    Thanks!

    Chris

Posting Permissions

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



Click Here to Expand Forum to Full Width