subroutine test_regex() call unit_check_start('M_regex') ! "Regexp, String, expected result" call mymatch("Foo", "FooBar", .true. ) call mymatch("Poo", "FooBar", .false. ) call mymatch("Bar", "FooBar", .true. ) call mymatch("Par", "FooBar", .false. ) call mymatch("Foo", "Foo", .true. ) call mymatch("Fo", "Foo", .true. ) call mymatch("Foo", "Fo", .false. ) call mymatch("ooB", "FooBar", .true. ) call mymatch("ooP", "FooBar", .false. ) call mymatch(".", "FooBar", .true. ) call mymatch("P.", "FooBar", .false. ) call mymatch("^Foo", "FooBar", .true. ) call mymatch("^Bar", "FooBar", .false. ) call mymatch("Foo$", "FooBar", .false. ) call mymatch("Bar$", "FooBar", .true. ) call mymatch(".*o", "FooBar", .true. ) call mymatch("o*o", "FooBar", .true. ) call mymatch("P*o", "FooBar", .true. ) call mymatch("Fo*o", "FooBar", .true. ) call mymatch("Po*o", "FooBar", .false. ) call mymatch(".+o", "FooBar", .true. ) call mymatch("o+o", "FooBar", .true. ) call mymatch("P+o", "FooBar", .false. ) call mymatch("Fo+o", "FooBar", .true. ) call mymatch("Po+o", "FooBar", .false. ) call mymatch(".?o", "FooBar", .true. ) call mymatch("o?o", "FooBar", .true. ) call mymatch("P?o", "FooBar", .true. ) call mymatch("Fo?o", "FooBar", .true. ) call mymatch("Po?o", "FooBar", .false. ) call mymatch("F[po]o", "FooBar", .true. ) call mymatch("F[op]o", "FooBar", .true. ) call mymatch("F[qp]o", "FooBar", .false. ) call mymatch("F[^po]o", "FooBar", .false. ) call mymatch("F[^op]o", "FooBar", .false. ) call mymatch("F[^qp]o", "FooBar", .true. ) call mymatch("F[po]*o", "FooBar", .true. ) call mymatch("F[56]*o", "F5oBar", .true. ) call mymatch("F[46]*o", "F5oBar", .false. ) call mymatch("F[46]*5", "F5oBar", .true. ) call mymatch("F[46]*5o", "F5oBar", .true. ) call mymatch("F[op]*o", "FooBar", .true. ) call mymatch("F[qp]*o", "FooBar", .true. ) call mymatch("P[qp]*o", "FooBar", .false. ) call mymatch("F[^po]*o", "FooBar", .true. ) call mymatch("F[^op]*o", "FooBar", .true. ) call mymatch("F[^qp]*o", "FooBar", .true. ) call mymatch("P[^qp]*o", "FooBar", .false. ) call mymatch("F[po]?o", "FooBar", .true. ) call mymatch("F[56]?o", "F5oBar", .true. ) call mymatch("F[46]?o", "F5oBar", .false. ) call mymatch("F[46]?5", "F5oBar", .true. ) call mymatch("F[46]?5o", "F5oBar", .true. ) call mymatch("F[op]?o", "FooBar", .true. ) call mymatch("F[qp]?o", "FooBar", .true. ) call mymatch("P[qp]?o", "FooBar", .false. ) call mymatch("F[^po]?o", "FooBar", .true. ) call mymatch("F[^op]?o", "FooBar", .true. ) call mymatch("F[^qp]?o", "FooBar", .true. ) call mymatch("P[^qp]?o", "FooBar", .false. ) call mymatch("F[po]+o", "FooBar", .true. ) call mymatch("F[56]+o", "F5oBar", .true. ) call mymatch("F[46]+o", "F5oBar", .false. ) call mymatch("F[46]+5", "F5oBar", .false. ) call mymatch("F[46]+5o", "F5oBar", .false. ) call mymatch("F[op]+o", "FooBar", .true. ) call mymatch("F[qp]+o", "FooBar", .false. ) call mymatch("P[qp]+o", "FooBar", .false. ) call mymatch("F[^po]+o", "FooBar", .false. ) call mymatch("F[^op]+o", "FooBar", .false. ) call mymatch("F[^qp]+o", "FooBar", .true. ) call mymatch("P[^qp]+o", "FooBar", .false. ) call mymatch("[0-9]+\.[0-9]*", "1.9", .true. ) call mymatch("[0-9]+\.[0-9]*", "1.99", .true. ) call mymatch("[0-9]+\.[0-9]*", "1.999", .true. ) call mymatch("[0-9]+\.[0-9]*", "1.9999", .true. ) call mymatch("[0-9]+\.[0-9]*", "1.99999", .true. ) call mymatch("[0-9]+\.[0-9]*", "11.99999", .true. ) call mymatch("[0-9]+\.[0-9]*", "111.99999", .true. ) call mymatch("[0-9]+\.[0-9]*", "1111.99999", .true. ) call mymatch("[0-9]+\.[0-9]*", "11111.99999", .true. ) call mymatch("[0-9]+\.[0-9]*", "111111.99999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "1.9", .true. ) call mymatch("^[0-9]+\.[0-9]*", "1.99", .true. ) call mymatch("^[0-9]+\.[0-9]*", "1.999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "1.9999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "1.99999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "11.99999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "111.99999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "1111.99999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "11111.99999", .true. ) call mymatch("^[0-9]+\.[0-9]*", "111111.99999", .true. ) call mymatch("a[0-9]+\.[0-9]*", "a1.9", .true. ) call mymatch("a[0-9]+\.", "a1.9", .true. ) call mymatch("a[0-9]+", "a1.9", .true. ) call mymatch("a", "a1.9", .true. ) call mymatch("\\", "\", .true. ) call mymatch("\.", "\", .false. ) call mymatch(".", "\", .true. ) call mymatch("F[qpo", "FooBar", .false.) ! intentional bad REGEX call unit_check_done('M_regex') end subroutine test_regex