WORKING WITH QTP

TestEveryThinG

Archive for September, 2011

How to Use the VBScript RegExp Object

Posted by rajivkumarnandvani on September 18, 2011

Hi All,
                                                                                                                                                                                                                                                        I faced a situation where I had to update the field’s value from another file. I can not use the string replace method because It will replace the all the matches value, While I want to replace the first match with the first value of another file.  Here I am trying to explain
                                                                                                                                                                                                                                                              First File Contents:
                                                                                                                                                                                                                                                             This blog refers to QTP.
I want to get first line value “=”  from another file.
Here I am using Rexexp
with global property value false
Now I want to get Second line value “=”  from another file.
Global property false will serach only first match
If regexp global property true then it search all the matches
Now I want to get Third line value “=”  from another file.
                                                                                                                                                                                                                                                             Second File Contents:
                                                                                                                                                                                                                                                                    Rajiv
Kumar
Nandvani
                                                                                                                                                                                                                                                                              I want output like this:
                                                                                                                                                                                                                                                            This blog refers to QTP.
I want to get first line value “Rajiv”  from another file.
Here I am using Rexexp
with global property value false
Now I want to get Second line value “Kumar”  from another file.
Global property false will serach only first match
If regexp global property true then it search all the matches
Now I want to get Third line value “Nandvani”  from another file.
                                                                                                                                                                                                                                                           Here is the code that I have used to solve this problem
Read the Rest in TestEveryThinGQTP….

Posted in QTP | Leave a Comment »

 
%d bloggers like this: