QTP Forum


Join the forum, it's quick and easy

QTP Forum
QTP Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Poll
Keywords

Latest topics
» composite primary key
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyThu Jun 19, 2014 11:31 am by thomasdfg

» How to identify the object when it is dynamically changing behavior
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 6:37 pm by thomasdfg

» Patches for QTP 10, 11, 11.5
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 6:04 pm by thomasdfg

» Retrieving data from Txt file into datatable
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 5:32 pm by thomasdfg

» VB Script to count number of links in a web page.
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 4:51 pm by thomasdfg

» Customized HTML reports in QTP
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 4:42 pm by thomasdfg

» how to print values into a field of a web page, from a data table in qtp?
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 4:37 pm by thomasdfg

» How to delete cookies using QTP?
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 4:30 pm by thomasdfg

» When UFT Does Not Identify an Object
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. EmptyWed Jun 18, 2014 4:23 pm by thomasdfg

November 2024
MonTueWedThuFriSatSun
    123
45678910
11121314151617
18192021222324
252627282930 

Calendar Calendar

Affiliates
free forum


Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string.

Go down

Vote if this topic was useful to you

Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_lcap0%Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_rcap 0% 
[ 0 ]
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_lcap0%Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_rcap 0% 
[ 0 ]
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_lcap100%Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_rcap 100% 
[ 1 ]
Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_lcap0%Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Vote_rcap 0% 
[ 0 ]
 
Total Votes : 1
 
 

Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string. Empty Using a RegExp object, how to find the match of all occurrences of a search string pattern inside a target string.

Post by Gajre Fri Jul 06, 2012 1:26 am

''This sub finds the matches in a Input String

Sub RegExpSub(strMatchPattern, strInputPhrase)
'create variables
Dim objRegEx, Match, Matches, StrReturn
'create instance of RegExp object
Set objRegEx = New RegExp
'find all matches
objRegEx.Global = True
'set case insensitive
objRegEx.IgnoreCase = True
'set the pattern
objRegEx.Pattern = strMatchPattern
'create the collection of matches
Set Matches = objRegEx.Execute(strInputPhrase)
'print out all matches
For Each Match in Matches
StrReturn = "Match found at position "
StrReturn = StrReturn & Match.FirstIndex & ", and the Match Value is " & Match.Value
MsgBox StrReturn
Next
End Sub

'call the subroutine
Call RegExpSub("is.", "Is1 is2 Is3 is4")

''Output of execution:
'Match found at position 0, and the Match Value is Is1
'Match found at position 4, and the Match Value is is2
'Match found at position 8, and the Match Value is Is3
'Match found at position 12, and the Match Value is is4
Gajre
Gajre
Admin

Posts : 37
Join date : 2012-06-17
Age : 42
Location : Hyderabad

https://qtpelearning.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum