Jump to content

zlocm

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by zlocm

  1. I have expression:<tr id = "ololo">Hello World <br> !!!</tr>

    Output should be: Hello World !!!

    But, it was: My sequence:Hello World <br> !!!

    This library (perl regexp) works fine with python, so this regexp get right result, but LAbView not.

    This pthon script:

    [/color][color=#1C2837]import reif __name__ == '__main__':    data = '''&lt;tr id = "ololo"&gt;Hello World &lt;br&gt; !!!&lt;/tr&gt;'''    table_regex = re.compile("&lt;(.*?)&gt;",re.IGNORECASE)    print("FIRST EXRESSION ---------------------")       print(table_regex.search(data).group())    print("SECOND EXRESSION---------------------")       p2 = data[table_regex.search(data).end():]    print(table_regex.search(p2).group())    print("THIRD EXRESSION---------------------")    p3 = p2[table_regex.search(p2).end():]    print(table_regex.search(p3).group())    pass[/color][color=#1C2837]

    returns:

    FIRST EXRESSION ---------------------

    <tr id = "ololo">

    SECOND EXRESSION---------------------

    <br>

    THIRD EXRESSION---------------------

    </tr>

    so, this regexp should works fine.

    What's the problem? What should the output be?

    As far as the problem in your original VI, you're using Shift Registers with the Match Regular Expression node incorrectly. You can't use the Offset After Match if you're only going to search what was found before and after the previous match. Savvy?

    post-7534-097691200 1287151082_thumb.png

    Yours will not miss nested tags line break characters. If the tag spans multiple lines the "bad" regular expression will fail.

    Oh, you right, thanks.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.