QTP – How Do I Love Thee? Let me RegEx the Ways

Hard at work automating tests for your company’s latest application, you abruptly feel a sharp pain in your rump. Almost immediately, you are overcome by feelings of amore. Cupid’s arrow strikes again — but being a testing geek, instead of falling madly in love with a hottie, you are overcome with the desire to automate. Your head fills with the lines of your favorite love poem — How Do I love Thee by Elizabeth Barrett Browning:

The REgEx Execute method is used to run a search using a regular expression:

Replace Method

You can also use the Replace method to count the appearances of a word or pattern. This method replaces the text found in a search using a regular expression. To replace all the occurrences of the word thee with you in the poem you can do the following:

Copyright text 2019 by Joe Colantonio | TestTalks Privacy Policy Disclaimer All the contents of the Blog, EXCEPT FOR COMMENTS, constitute the opinion of the Author and the Author alone; they do not represent the views and opinions of the Author’s employers, supervisors, nor do they represent the view of organizations, businesses or institutions the Author is a part of. Privacy Policy | Sitemap