1
/* Copyright (C) 1996 Tom Lord
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU Library General Public License as published by
5
* the Free Software Foundation; either version 2, or (at your option)
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Library General Public License for more details.
13
* You should have received a copy of the GNU Library General Public License
14
* along with this software; see the file COPYING. If not, write to
15
* the Free Software Foundation, 59 Temple Place - Suite 330,
16
* Boston, MA 02111-1307, USA.
28
main(int argc, char * argv[])
39
if (regcomp (&r, "(abc|abcd)(d|)", REG_EXTENDED))
41
printf ("### unexpected compilation error\n");
45
if (regexec (&r, "abcd", 10, regs, 0))
47
printf ("### unexpected regexec error\n");
54
printf ("regexp is (abc|abcd)(d|)\n");
56
for (x = 0; x < 3; ++x)
57
printf ("reg %d == (%d, %d) %.*s\n",
61
regs[x].rm_eo - regs[x].rm_so,
62
"abcd" + regs[x].rm_so);
64
if ((regs[1].rm_eo - regs[1].rm_so) != 4)
66
printf ("### regexec returned a match which is not leftmost longest for subexpression 1\n");