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.




Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Join the fastest growing Performance Engineers club at ClubhouseSHOW ME HOW
+ +
Share via
Copy link