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
#2
Solved: 9 Years, 6 Months, 3 Weeks ago
Hi Folks,
I have solved my problem.
Though I will not be able to explain myself, I took a piece of code and experimentally made it plug in with my scenario.
Here it is:
Code:
Dim Format, matches, regexp
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)
    Call RegExpTest("\w.*\s\/\s.*", format)

        If Format = Environment("check") 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
Call fn_StepResult(Environment("Counter"),Environment("RRC"),0,1,"Step 10.1","Pass: All of the " & Environment("RRC") & " records have been validated to check for correct MSP client / Loan # format and are as expected.","Fail: In the Loan Number column out of " & Environment("RRC") & "records, " & Environment("FCounter") & " records have the incorrect MSP client # / Loan Number format, for more details view the actual results to see what the loan number are.")


Public Function RegExpTest (patrn, strng)
   Dim regEx, Match, Matches, retstr  
   Set regEx = New RegExp  
   regEx.Pattern = patrn  
   regEx.IgnoreCase = True  
   regEx.Global = True  
   Set Matches = regEx.Execute(strng)   '

  For Each Match in Matches  
     RetStr = Match.Value
   Next
Environment.Value("check") = RetStr
End Function

Please feel free to come up with the best answer, I am still open to any suggestions, thanks

-Prateep K.
Banglore, India
Reply
Jump to the post that solved this thread.


Messages In This Thread
RE: How to validate a format of an alphanumeric string - by PrateepKaraval - 11-07-2014, 03:35 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,668 04-21-2018, 11:06 AM
Last Post: Ankur
  How to validate tool tip in a web page? qtplearner88 3 4,205 04-24-2013, 05:19 PM
Last Post: nucleation
  How to Check Alphanumeric's from webtable branjitk 1 3,405 06-28-2012, 02:20 PM
Last Post: supputuri
Exclamation How to validate color of image object in a web page qtplearner88 9 8,694 06-14-2012, 06:34 PM
Last Post: Shridevi.Salagare
  Pdf to Excel or any other Format Conversion branjitk 1 2,354 06-14-2012, 08:14 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)