Wednesday, 19 October 2011

QTP Script: Using Locate to determine if specific text exists within a string


MsgBox LocateText("www.QTPHelper.com""QTP")
MsgBox LocateText("www.QTPHelper.com""QTP.*.com")

' =============================================================
' function: LocateText
' desc :    Uses a regular expression to locate text within a string
' params :  strString is the string to perform the search on
'           strPattern is the regular expression
' returns : True if the pattern was found, False otherwise
' =============================================================
Function LocateText(strStringstrPattern)

Dim objRegEx

' create the regular expression
Set objRegEx = New RegExp 

' set the pattern 
objRegEx.Pattern = strPattern

' ignore the casing
objRegEx.IgnoreCase = True

' perform the search
LocateText = objRegEx.Test(strString)

' destroy the object
Set objRegEx = Nothing

End Function ' LocateText 

11 comments:

  1. My family every time say that I am wasting my time here at net, except I know
    I am getting know-how daily by reading thes good posts.


    Here is my homepage - play minecraft free

    ReplyDelete
  2. It's a shame you don't have a donate button!
    I'd definitely donate to this outstanding blog! I suppose for
    now i'll settle for book-marking and adding your RSS feed to
    my Google account. I look forward to new updates and will talk about this
    website with my Facebook group. Chat soon!

    my site; Nutrition Bars

    ReplyDelete
  3. I'm now not sure where you're getting your info, however good topic.

    I must spend a while finding out more or working out more.
    Thanks for great info I was in search of this information for my
    mission.

    Here is my web-site :: Quest Bars

    ReplyDelete
  4. Aw, this was a very good post. Finding the time and actual
    effort to generate a good article… but what can I say… I procrastinate a
    whole lot and don't seem to get nearly anything done.



    Look at my blog post; Quest Bars

    ReplyDelete
  5. You actually make it appear really easy with
    your presentation but I find this matter to be really one thing that I think I'd
    never understand. It seems too complex and very wide for me.
    I am taking a look forward for your subsequent submit, I'll attempt to get
    the grasp of it! Quest Bars blogesaurus

    ReplyDelete
  6. Just want to say your article is as amazing. The clarity to your put up is
    just nice and that i can suppose you're a professional in this subject.
    Well together with your permission allow me to snatch your feed to
    keep up to date with impending post. Thanks one million and please continue the enjoyable
    work.

    My homepage :: Diet Plans for Women to Lose Weight

    ReplyDelete
  7. Piece of writing writing is also a fun, if you know then you can write or
    else it is complex to write. Quest Bars
    blogesaurus

    ReplyDelete
  8. This piece of writing will help the internet viewers
    for setting up new webpage or even a weblog from start
    to end.

    My site :: Diet Plans for Women to Lose Weight

    ReplyDelete
  9. Nice blog here! Also your website loads up fast! What web host are you using?
    Can I get your affiliate link to your host?
    I wish my site loaded up as quickly as yours lol

    Also visit my homepage - Diet Plans for Women to Lose Weight

    ReplyDelete
  10. This is really interesting, You're a very skilled blogger.
    I've joined your feed and look forward to seeking more
    of your wonderful post. Also, I have shared your website in my social networks!


    Here is my web site Diet Plans for Women to Lose Weight

    ReplyDelete
  11. I was pretty pleased to discover this web site. I want
    to to thank you for your time for this particularly fantastic read!!
    I definitely liked every part of it and i also
    have you book marked to look at new stuff in your site.


    Take a look at my weblog Coconut Oil Hair

    ReplyDelete