July 16, 2013

How to normalize strings in HP QTP (UFT)?

In this blog post, we will see how to normalize strings in HP QTP (UFT). Below code receives string and then convert it to equivalent string in a regular expression format. Below snippet uses Replace function.

Msgbox NormalizeStringFunc ("Q+A*I.n?sight\s")

Function NormalizeStringFunc(MyStr)
    Dim TempStr
    TempStr = Replace(MyStr, "\", "\\")
    TempStr = Replace(TempStr, "*", "\*")
    TempStr = Replace(TempStr, "+", "\+")
    TempStr = Replace(TempStr, ".", "\.")
    NormalizeStringFunc = Replace(TempStr, "?", "\?")
End function

Output of above code is as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to normalize strings in HP QTP (UFT) – QAInsights” alt=”How to normalize strings in HP QTP (UFT) – QAInsights” iframe=”false” frame=”true” crop=”true”][/auto_thumb]

Thanks for visiting QAInsights! Check out our new portal to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything. Searching for QA Jobs Openings, check it at

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel | Subscribe our free weekly newsletter.




About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook,, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *