Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to validate a format of an alphanumeric string
#1
Solved: 9 Years, 5 Months, 3 Weeks ago
Hello Everyone,

I have a webtable with strings as follows:

NA / 123456789
REV / 1239359
GEM / G000018017
472 / 1233574
106 / 1233000171

The client wants me to validate the format of the strings above.
The format is XX* / XXXX*

Rules of Format: MSP Client # / Loan Number
.there is a space before and after the /
.the MSP # can be 2 or 3 characters of alphanumeric
.the / forwardslash is always present between the MSP and Loan #
.the Loan Number can be from 4 - 10 characters of alphanumeric

With the rules being said I have searched up and down many places to find the appropriate method for my string format check.
There were no VBScript functions that were specific to my needs.
I then decided to make my own by creating a regular expression string using the Regular expression evaluator and made sure the regexp is matching the string.
Here it is:
Code:
Dim Format
Set Myp = Browser("Title:=.*").Page("Title:=.*")
Set Myo = Description.Create()
    myo("name").Value = "case"
    RC = Myp.WebTable(myo).RowCount
    RCstop = RC - 1
    Environment.Value("RRC") = RC - 3
    Environment.Value("Counter") = 0
    Environment.Value("FCounter") = 0
    
    For i = 3 to RCstop
        Format = Myp.WebTable(myo).GetCellData(i,3) 'WPP / 1236547896 is the actual
    
        If Format = "\w.*\s\/\s.*"Then
                Environment.Value("Counter") = Environment("Counter") + 1
            Else
                Environment.Value("FCounter") = Environment("FCounter") + 1
                Reporter.ReportEvent micFail, "Row " & i, "The Loan Number " & Format & " data format is incorrect."
        End If
    Next

As you can see in my code the string "WPP / 1236547896" should match regexp string "\w.*\s\/\s.*", but step is failing for all rows.

Please help with this. Thank you
Reply
Jump to the post that solved this thread.


Messages In This Thread
How to validate a format of an alphanumeric string - by PrateepKaraval - 11-07-2014, 01:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to change 24 hrs time format to 12 hrs time format Varsha Gupta 1 2,647 04-21-2018, 11:06 AM
Last Post: Ankur
  How to validate tool tip in a web page? qtplearner88 3 4,144 04-24-2013, 05:19 PM
Last Post: nucleation
  How to Check Alphanumeric's from webtable branjitk 1 3,371 06-28-2012, 02:20 PM
Last Post: supputuri
Exclamation How to validate color of image object in a web page qtplearner88 9 8,626 06-14-2012, 06:34 PM
Last Post: Shridevi.Salagare
  Pdf to Excel or any other Format Conversion branjitk 1 2,332 06-14-2012, 08:14 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)