Menu

#68 pattern match bug involving alternation

closed
nobody
None
5
2007-07-09
2005-11-30
No

Some pattern match expressions evaluate as false when
they should be true. The examples so far all involve
fairly complex search strings and patterns with
alternation and multiple open ended patterns, such as
1(.e1p,.p).an1"sarcoma". The result varies with the
number of characters inserted before a common search
string that should be matched by a given pattern.

The test results below are from a MUMPS command shell
(part of M2Web) and textchk-dx is the name of a macro
defined below to simplify repeated testing of different
patterns. I believe that in all of the tests below,
@textchk should evaluate as true.

;testing pattern match operator
w $zversion
GT.M V5.0-000 Linux x86

def textchk-dx(textchk) s text=dx f i=1:1:64 w @textchk
w:i#8=0 " " s text=" "_text

s dx="bone (vertebral bodies: t4, t9, t11, t13, l3):
metastatic osteosarcoma"

textchk-dx text?1(.e1p,.p).an1"sarcoma"
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(.e1p,0p).an1"sarc".e
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(.e1p,1p).an1"sarc".e
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(.e1p,.e).an1"sarc".e
11111111 11111111 11111111 11111111 11111111 11111111
11111111 11111111

textchk-dx text?1(.p,.e1p).an1"sarc".e
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(0p,.e1p).an1"sarc".e
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(1p,.e1p).an1"sarc".e
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(.e,.e1p).an1"sarc".e
11111111 11111111 11111111 11111111 11111111 11111111
11111111 11111111

textchk-dx text?1(.e1p).an1"sarc".e
11111111 11111111 11111111 11111111 11111111 11111111
11111111 11111111

textchk-dx text?.1(.e1p).an1"sarc".e
11111111 11111111 11111111 11111111 11111111 11111111
11111111 11111111

textchk-dx text?1(1.e,.e1p).an1"sarc".e
11111111 11111111 11111111 11111111 11111111 11111111
11111111 11111111

textchk-dx text?1(1.p,.e1p).an1"sarc".e
01110011 00011000 11001100 11000000 10000000 00110000
11111111 11111111

textchk-dx text?1(.an,.e1p.an)1"sarc".e
11111111 11111111 11111111 11111111 11111111 11111111
11111111 11111111

Discussion

  • Malleswara Rao P

    Logged In: YES
    user_id=220075

    Hi James,
    Thanks for reporting the bug. GT.M seems to have problems
    with pattern expressions mixed with alternations. In order
    to find the exact cause, we need much more analysis and
    research. We've created the following tracking number to
    address this in a future release.

    S9F11-002577 Patterns mixed with alternations do not work
    as expected

    It looks like the problem disappears if you remove the
    pattern that follows the alternation by merging into the
    alternation such as your last case. For example, you can
    use 1(.e1p.an,.p.an)1"sarcoma" instead of 1
    (.e1p,.p).an1"sarcoma".

    Thanks
    -malli
    GT.M Developer
    Fidelity Information Services, Inc.

     
  • Malleswara Rao P

    Logged In: YES
    user_id=220075

    Hi James,
    Thanks for reporting the bug. GT.M seems to have problems
    with pattern expressions mixed with alternations. In order
    to find the exact cause, we need much more analysis and
    research. We've created the following tracking number to
    address this in a future release.

    S9F11-002577 Patterns mixed with alternations do not work
    as expected

    It looks like the problem disappears if you remove the
    pattern that follows the alternation by merging into the
    alternation such as your last case. For example, you can
    use 1(.e1p.an,.p.an)1"sarcoma" instead of 1
    (.e1p,.p).an1"sarcoma".

    Thanks
    -malli
    GT.M Developer
    Fidelity Information Services, Inc.

     
  • James A Self

    James A Self - 2005-12-14

    Logged In: YES
    user_id=37201

    I found another pattern match problem with the repetition
    count on an alternation with a single pattern inside.

    The first test below should evaluate as true. If a second
    alternative is included, it will return true even when the
    new alternative fails to match, such as the 7th and 8th
    examples below.

    ;testing pattern match bug
    s text="sarcoma"
    w text?.1(.e1p)1"sarc".e
    0

    w text?.2(.e1p)1"sarc".e
    0

    w text?1(.e1p)1"sarc".e
    0

    w text?.1(.e1p,0p)1"sarc".e
    1

    w text?.2(.e1p,0p)1"sarc".e
    1

    w text?1(.e1p,0p)1"sarc".e
    1

    w text?.1(.e1p,1p)1"sarc".e
    1

    w text?.2(.e1p,1p)1"sarc".e
    1

    w text?1(.e1p,1p)1"sarc".e
    0

    w text?.1(.e1p,.1p)1"sarc".e
    1

    w text?.2(.e1p,.1p)1"sarc".e
    1

    w text?1(.e1p,.1p)1"sarc".e
    1

    w text?0.1(.e1p,.1p)1"sarc".e
    1

    w text?0.2(.e1p,.1p)1"sarc".e
    1

    w text?0.1(.e1p,0p)1"sarc".e
    1

    w text?0.2(.e1p,0p)1"sarc".e
    1

    w text?0.1(.e1p)1"sarc".e
    0

    w text?0.2(.e1p)1"sarc".e
    0

     
  • Narayanan Iyer

    Narayanan Iyer - 2005-12-15

    Logged In: YES
    user_id=97919

    Jim,

    Thank you for reporting another problem with pattern
    matching. After some investigation, we have been able to
    identify the issue for both the problems that you reported
    in this thread. The fix for both these issues will be
    available in the next GT.M release.

    Thanks,
    Narayanan.

     
  • Narayanan Iyer

    Narayanan Iyer - 2007-07-09

    Logged In: YES
    user_id=97919
    Originator: NO

    This issue is fixed as part of S9F11-002577 in GT.M V5.0-000D.

     
  • Narayanan Iyer

    Narayanan Iyer - 2007-07-09
    • status: open --> closed
     

Log in to post a comment.