Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB script Coding with strings.
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Try this,
Code:
strng="ABC is good at testing.ABC is working on PC.ABC is playing games."
Function RegExpTest(patrn, strng)
   Dim regEx, Match, Matches   ' Create variable.
   Set regEx = New RegExp   ' Create a regular expression.
   regEx.Pattern = patrn   ' Set pattern.
   regEx.IgnoreCase = True   ' Set case insensitivity.
   regEx.Global = True   ' Set global applicability.
   Set Matches = regEx.Execute(strng)   ' Execute search.
   For Each Match in Matches   ' Iterate Matches collection.
      RetStr = RetStr & "Match found at position "
      RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
      RetStr = RetStr & Match.Value & "'." & vbCRLF
   Next
   RegExpTest = RetStr
   msgbox "No of occorences:  "&Matches.count
End Function
MsgBox(RegExpTest("abc.",strng))

Regards,
Ravi
Reply


Messages In This Thread
VB script Coding with strings. - by Tejas Tikhe - 07-15-2012, 12:39 PM
RE: VB script Coding with strings. - by ravi.gajul - 07-15-2012, 03:02 PM
RE: VB script Coding with strings. - by DevilkID - 09-11-2012, 11:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Smile How to join sub strings in UFT without using join built-in function? chetna 1 1,914 07-05-2018, 05:39 PM
Last Post: Ankur
  Parametrize and Concatenate Strings Aisha2015 1 2,071 08-13-2015, 08:45 AM
Last Post: Ankur
  need a coding standards for the project sush 0 1,898 03-01-2008, 09:46 AM
Last Post: sush

Forum Jump:


Users browsing this thread: 1 Guest(s)