User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 1 of 1
  1. #1
    SQA Knight
    Join Date
    Jul 1999
    Grand Rapids, MI
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)
    Total Downloaded

    web_reg_save_param_regexp() search with CRLF

    This posting discusses creating a regular expression to parse over multiple lines (i.e. the search pattern includes one or more CRLF char combinations) to extract desired correlations.

    I am currently using LR 11.04 but have 12.02 installed on another PC. So I have access to both versions function reference. 11.04 is very poorly documented when it comes to using regex in the web_reg_save_param_regexp() function. While the version 12 doc is much improved and actually has some regex examples there is no discussion on how your create a "RegExp=blah..." statement that searches over multiple lines terminated by CRLF chars.

    The documentation says the regex engine is a Perl implementation, but they fail to indicate what version. But in all versions Perl regex supports modifiers such as /s which treats "string" as a single line. But I have found no way to successfully pass the /s modifier. Does anyone know if there is a way to do that or if this a limitation with LR's implementation?

    I finally really needed to use web_reg_save_param_regexp() rather than a bunch of web_reg_save_param() correlations (after which I would have to create C arrays, etc. etc. to filter out unwanted ID numbers).

    The raw response stream has 50 to 100 of the following patterns that I want to capture the DCxxx number from. Note there are two newlines in the pattern:
    <input id="ID_0_" name="ID[0]" type="hidden" value="732" />
    <td><input class="checkbox" id="CheckBox_0_" name="CheckBox[0]" type="checkbox" value="true" /><input name="CheckBox[0]" type="hidden" value="false" /></td>
    <td><a href="/ccatsII/Assignment/FacilitiesRedirect/DC913">DC913</a></td>
    and here is what LR shows in the replay log (explicitly showing the two CRLFs):
    Action.c(395):                                                                 <input id="ID_0_" name="ID[0]"
    Action.c(395):      type="hidden" value="732" />\r\n
    Action.c(395):                                                                 <td><input class="checkbox" id
    Action.c(395):     ="CheckBox_0_" name="CheckBox[0]" type="checkbox" value="true" /><input name="CheckBox[0]"
    Action.c(395):      type="hidden" value="false" /></td>\r\n
    Action.c(395):                                                                 <td><a href="/ccatsII/Assignme
    Action.c(395):     nt/FacilitiesRedirect/DC913">DC913</a></td>\r\n
    And then there are several hundred more ...FacilitiesRedirect/DCxxx" patterns that I don't want to capture and these patterns are almost identical as above with the exception of their starting <input xxx= name. Thus my starting "anchor" in the regex expression needs to be <input id to get just the ID numbers I want and ignore the rest.

    Thus the regex pattern to snag just the desired IDs that I want to use (and wasted hours trying to get to work) is:

    web_reg_save_param_regexp(... "RegExp=<input id.+Redirect/(.*)\"", ...
    web_reg_save_param_regexp(... "RegExp=<input id.+Redirect/(.*)\"/s", ...

    But I found after much time that I had to specify each \r\n explicitly in the regex expression, so this finally worked:

    web_reg_save_param_regexp(""RegExp=<input id.+\\r\\n.+\\r\\n.+Redirect/(.*)\"", ...

    So if anyone can show me how to use the Perl regex /s modifier to work I would appreciate it.

    -Thanks, Terry Horwath
    Last edited by Terry Horwath; 08-07-2015 at 12:28 PM.



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.

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 08:56 PM.

Copyright BetaSoft Inc.