SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Jun 2007
    Posts
    513
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    problem using regular expression

    Hello, I have a window and the property "regexpwndtitle" value changes partially everytime. For instance regexpwndtitle = One|New|Task, Two|New|Task, Three|New|Task. I have used the regular expressions as .*sNumber|New|Task in the object repository and want to verify if the window exist. Somehow it is not working. Can someone help? Thanks.
    -----------------------------------
    sNumber = One
    If Window("ABC").Exists(0) Then
    Print("found")
    Else
    Print("not found")

  2. #2
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem using regular expression

    Pipe | has special meaning in the regular expression, try to escape it with a back slash character \

  3. #3
    Senior Member
    Join Date
    Jun 2007
    Posts
    513
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem using regular expression

    I did not use the pipe symbol. the original value for the regexpwndtitle was with the pipe symbol and it works fine if I use One|New|Task. However since everytime with different search result the first value changes, i tried to replace it with the variable called sNumber|New|Task in OR. Should I still try to replace | with \? Please confirm. Thanks for ur help.

  4. #4
    Senior Member
    Join Date
    Jun 2007
    Posts
    513
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem using regular expression

    I used the back slash as One\|New\|Task, however it still does not work. Any suggestions? Thanks

  5. #5
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem using regular expression

    .*\|New\|Task

    Here is the example how it works.
    <font class="small">Code:</font><hr /><pre> Function RegExpTest(patrn, strng)
    Dim regEx, Match, Matches ' Create variable.
    Set regEx = New RegExp ' Create a regular expression.
    regEx.Pattern = patrn ' Set pattern.
    regEx.IgnoreCase = True ' Set case insensitivity.
    regEx.Global = True ' Set global applicability.
    RegExpTest = regEx.Test(strng) ' Execute search.
    End Function
    MsgBox(RegExpTest(".*\|New\|Task", "One|New|Task")) 'True
    MsgBox(RegExpTest(".*\|New\|Task", "One|Newxxx|Task")) 'False
    MsgBox(RegExpTest(".*\|New\|Task", "Two|New|Task")) 'True
    MsgBox(RegExpTest(".*\|New\|Task", "Two|Newxxx|Task")) 'False
    MsgBox(RegExpTest(".*\|New\|Task", "Three|New|Task")) 'True
    MsgBox(RegExpTest(".*\|New\|Task", "Three|Newxxx|Task")) 'False
    </pre><hr />

  6. #6
    Senior Member
    Join Date
    Jun 2007
    Posts
    513
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: problem using regular expression

    Thank you.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:59 AM.

Copyright BetaSoft Inc.