SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Aug 2005
    Location
    Poland
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Problem with regular expressions

    Hi there,

    I've created a compiled module in WR with function in which I try to use regular expressions as below:

    obj_get_info("{class: static_text, index: " & i & "}", "label", name);
    if (name != "!NewBinary[0-9][0-9]")
    {
    ...some instructions...
    }

    I've tried to use at least two combinations of regular experssions, first as above, second with "!NewBinary.*" but it doesn't work at all...

    If anybody can tell me why reglar expressions don't work I'll be graceful.

    Best regards,
    Qbek

  2. #2
    Junior Member
    Join Date
    Jan 2005
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem with regular expressions

    As I know, for regular expressions you should use match function.

  3. #3
    Senior Member
    Join Date
    May 2003
    Location
    Austria
    Posts
    1,480
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem with regular expressions

    Originally posted by pruscoe (at winrunner@yahoogroups.com):
    Well, a coiuple of problems. First, as far as I remember, you can't use a Regex "raw" in and IF statement like that. You need to use match ()

    Second, the "!" is only required in physical descriptions.

    Third, your escaped quotes will result in the quotes' being part of the string you're trying to compare, so it will always fail (because the name won't contain quotes.

    I don't currently have access to WR, so I can't give you a corrected code sample.
    <font size="2" face="Verdana, Arial, Helvetica">I will give it a try:
    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">if (match(name, &quot;NewBinary[0-9][0-9]&quot == 1))</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">This checks if the first position of your string is the starting point for the regular expression.
    If you want to check for an exact match, you'll also have to compare the length of the regular expression against the length of your string:
    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">if (match(name, &quot;NewBinary[0-9][0-9]&quot == 1) &amp;&amp; (RLENGTH == length(name))</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Regards,
    Juergen

 

 

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 10.71%
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 10:08 PM.

Copyright BetaSoft Inc.