1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2007-2008 - INRIA
4//
5//  This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- CLI SHELL MODE -->
8//===================================================================
9// unit tests regexp
10//===================================================================
11lf = ascii(10);
12if regexp('abc','/abc/','o') <>  1 then bugmes();quit;end
13ierr = execstr("regexp(''abc'',''/abc/'',''r'');","errcatch");
14if ierr <> 999 then bugmes();quit;end
15t = 'aaa aab aac aad aae';
16pattern = '/aa/';
17[start_pos, end_pos, match_str] = regexp(t,pattern,'o');
18if size(start_pos,'*') <> 1 then bugmes();quit;end
19if size(end_pos,'*') <> 1 then bugmes();quit;end
20if start_pos <> 1 then bugmes();quit;end
21if end_pos <> 2 then bugmes();quit;end
22//===================================================================
23if regexp('abc'                                     ,'/abc/'                                 ) <>  1   then bugmes();quit;end
24if regexp('xbc'                                     ,'/abc/'                                 ) <>  []  then bugmes();quit;end
25if regexp('axc'                                     ,'/abc/'                                 ) <>  []  then bugmes();quit;end
26if regexp('abx'                                     ,'/abc/'                                 ) <>  []  then bugmes();quit;end
27if regexp('xabcy'                                   ,'/abc/'                                 ) <>  2   then bugmes();quit;end
28if regexp('ababc'                                   ,'/abc/'                                 ) <>  3   then bugmes();quit;end
29if regexp('abc'                                     ,'/ab*c/'                                ) <>  1   then bugmes();quit;end
30if regexp('abc'                                     ,'/ab*bc/'                               ) <>  1   then bugmes();quit;end
31if regexp('abbc'                                    ,'/ab*bc/'                               ) <>  1   then bugmes();quit;end
32if regexp('abbbbc'                                  ,'/ab*bc/'                               ) <>  1   then bugmes();quit;end
33if regexp('abbbbc'                                  ,'/.{1}/'                                ) <>  1   then bugmes();quit;end
34if regexp('abbbbc'                                  ,'/.{3,4}/'                              ) <>  1   then bugmes();quit;end
35if regexp('abbbbc'                                  ,'/ab{0,}bc/'                            ) <>  1   then bugmes();quit;end
36if regexp('abbc'                                    ,'/ab+bc/'                               ) <>  1   then bugmes();quit;end
37if regexp('abc'                                     ,'/ab+bc/'                               ) <>  []  then bugmes();quit;end
38if regexp('abq'                                     ,'/ab+bc/'                               ) <>  []  then bugmes();quit;end
39if regexp('abq'                                     ,'/ab{1,}bc/'                            ) <>  []  then bugmes();quit;end
40if regexp('abbbbc'                                  ,'/ab+bc/'                               ) <>  1   then bugmes();quit;end
41if regexp('abbbbc'                                  ,'/ab{1,}bc/'                            ) <>  1   then bugmes();quit;end
42if regexp('abbbbc'                                  ,'/ab{1,3}bc/'                           ) <>  1   then bugmes();quit;end
43if regexp('abbbbc'                                  ,'/ab{3,4}bc/'                           ) <>  1   then bugmes();quit;end
44if regexp('abbbbc'                                  ,'/ab{4,5}bc/'                           ) <>  []  then bugmes();quit;end
45if regexp('abbc'                                    ,'/ab?bc/'                               ) <>  1   then bugmes();quit;end
46if regexp('abc'                                     ,'/ab?bc/'                               ) <>  1   then bugmes();quit;end
47if regexp('abc'                                     ,'/ab{0,1}bc/'                           ) <>  1   then bugmes();quit;end
48if regexp('abbbbc'                                  ,'/ab?bc/'                               ) <>  []  then bugmes();quit;end
49if regexp('abc'                                     ,'/ab?c/'                                ) <>  1   then bugmes();quit;end
50if regexp('abc'                                     ,'/ab{0,1}c/'                            ) <>  1   then bugmes();quit;end
51if regexp('abc'                                     ,'/^abc$/'                               ) <>  1   then bugmes();quit;end
52if regexp('abcc'                                    ,'/^abc$/'                               ) <>  []  then bugmes();quit;end
53if regexp('abcc'                                    ,'/^abc/'                                ) <>  1   then bugmes();quit;end
54if regexp('aabc'                                    ,'/^abc$/'                               ) <>  []  then bugmes();quit;end
55if regexp('aabc'                                    ,'/abc$/'                                ) <>  2   then bugmes();quit;end
56if regexp('aabcd'                                   ,'/abc$/'                                ) <>  []  then bugmes();quit;end
57if regexp('abc'                                     ,'/a.c/'                                 ) <>  1   then bugmes();quit;end
58if regexp('axc'                                     ,'/a.c/'                                 ) <>  1   then bugmes();quit;end
59if regexp('axyzc'                                   ,'/a.*c/'                                ) <>  1   then bugmes();quit;end
60if regexp('axyzd'                                   ,'/a.*c/'                                ) <>  []  then bugmes();quit;end
61if regexp('abc'                                     ,'/a[bc]d/'                              ) <>  []  then bugmes();quit;end
62if regexp('abd'                                     ,'/a[bc]d/'                              ) <>  1   then bugmes();quit;end
63if regexp('abd'                                     ,'/a[b-d]e/'                             ) <>  []  then bugmes();quit;end
64if regexp('ace'                                     ,'/a[b-d]e/'                             ) <>  1   then bugmes();quit;end
65if regexp('aac'                                     ,'/a[b-d]/'                              ) <>  2   then bugmes();quit;end
66if regexp('a-'                                      ,'/a[-b]/'                               ) <>  1   then bugmes();quit;end
67if regexp('a-'                                      ,'/a[b-]/'                               ) <>  1   then bugmes();quit;end
68if regexp('a]'                                      ,'/a]/'                                  ) <>  1   then bugmes();quit;end
69if regexp('a]b'                                     ,'/a[]]b/'                               ) <>  1   then bugmes();quit;end
70if regexp('aed'                                     ,'/a[^bc]d/'                             ) <>  1   then bugmes();quit;end
71if regexp('abd'                                     ,'/a[^bc]d/'                             ) <>  []  then bugmes();quit;end
72if regexp('adc'                                     ,'/a[^-b]c/'                             ) <>  1   then bugmes();quit;end
73if regexp('a-c'                                     ,'/a[^-b]c/'                             ) <>  []  then bugmes();quit;end
74if regexp('a]c'                                     ,'/a[^]b]c/'                             ) <>  []  then bugmes();quit;end
75if regexp('adc'                                     ,'/a[^]b]c/'                             ) <>  1   then bugmes();quit;end
76if regexp('a-'                                      ,'/\ba\b/'                               ) <>  1   then bugmes();quit;end
77if regexp('-a'                                      ,'/\ba\b/'                               ) <>  2   then bugmes();quit;end
78if regexp('-a-'                                     ,'/\ba\b/'                               ) <>  2   then bugmes();quit;end
79if regexp('xy'                                      ,'/\by\b/'                               ) <>  []  then bugmes();quit;end
80if regexp('yz'                                      ,'/\by\b/'                               ) <>  []  then bugmes();quit;end
81if regexp('xyz'                                     ,'/\by\b/'                               ) <>  []  then bugmes();quit;end
82if regexp('a-'                                      ,'/\Ba\B/'                               ) <>  []  then bugmes();quit;end
83if regexp('-a'                                      ,'/\Ba\B/'                               ) <>  []  then bugmes();quit;end
84if regexp('-a-'                                     ,'/\Ba\B/'                               ) <>  []  then bugmes();quit;end
85if regexp('xy'                                      ,'/\By\b/'                               ) <>  2   then bugmes();quit;end
86if regexp('xy'                                      ,'/\By\b/'                               ) <>  2   then bugmes();quit;end
87if regexp('yz'                                      ,'/\by\B/'                               ) <>  1   then bugmes();quit;end
88if regexp('xyz'                                     ,'/\By\B/'                               ) <>  2   then bugmes();quit;end
89if regexp('a'                                       ,'/\w/'                                  ) <>  1   then bugmes();quit;end
90if regexp('-'                                       ,'/\w/'                                  ) <>  []  then bugmes();quit;end
91if regexp('a'                                       ,'/\W/'                                  ) <>  []  then bugmes();quit;end
92if regexp('-'                                       ,'/\W/'                                  ) <>  1   then bugmes();quit;end
93if regexp('a b'                                     ,'/a\sb/'                                ) <>  1   then bugmes();quit;end
94if regexp('a-b'                                     ,'/a\sb/'                                ) <>  []  then bugmes();quit;end
95if regexp('a b'                                     ,'/a\Sb/'                                ) <>  []  then bugmes();quit;end
96if regexp('a-b'                                     ,'/a\Sb/'                                ) <>  1   then bugmes();quit;end
97if regexp('1'                                       ,'/\d/'                                  ) <>  1   then bugmes();quit;end
98if regexp('-'                                       ,'/\d/'                                  ) <>  []  then bugmes();quit;end
99if regexp('1'                                       ,'/\D/'                                  ) <>  []  then bugmes();quit;end
100if regexp('-'                                       ,'/\D/'                                  ) <>  1   then bugmes();quit;end
101if regexp('a'                                       ,'/[\w]/'                                ) <>  1   then bugmes();quit;end
102if regexp('-'                                       ,'/[\w]/'                                ) <>  []  then bugmes();quit;end
103if regexp('a'                                       ,'/[\W]/'                                ) <>  []  then bugmes();quit;end
104if regexp('-'                                       ,'/[\W]/'                                ) <>  1   then bugmes();quit;end
105if regexp('a b'                                     ,'/a[\s]b/'                              ) <>  1   then bugmes();quit;end
106if regexp('a-b'                                     ,'/a[\s]b/'                              ) <>  []  then bugmes();quit;end
107if regexp('a b'                                     ,'/a[\S]b/'                              ) <>  []  then bugmes();quit;end
108if regexp('a-b'                                     ,'/a[\S]b/'                              ) <>  1   then bugmes();quit;end
109if regexp('1'                                       ,'/[\d]/'                                ) <>  1   then bugmes();quit;end
110if regexp('-'                                       ,'/[\d]/'                                ) <>  []  then bugmes();quit;end
111if regexp('1'                                       ,'/[\D]/'                                ) <>  []  then bugmes();quit;end
112if regexp('-'                                       ,'/[\D]/'                                ) <>  1   then bugmes();quit;end
113if regexp('abc'                                     ,'/ab|cd/'                               ) <>  1   then bugmes();quit;end
114if regexp('abcd'                                    ,'/ab|cd/'                               ) <>  1   then bugmes();quit;end
115if regexp('b'                                       ,'/$b/'                                  ) <>  []  then bugmes();quit;end
116if regexp('ab'                                      ,'/a\(*b/'                               ) <>  1   then bugmes();quit;end
117if regexp('a((b'                                    ,'/a\(*b/'                               ) <>  1   then bugmes();quit;end
118if regexp('aabbabc'                                 ,'/a+b+c/'                               ) <>  5   then bugmes();quit;end
119if regexp('aabbabc'                                 ,'/a{1,}b{1,}c/'                         ) <>  5   then bugmes();quit;end
120if regexp('abcabc'                                  ,'/a.+?c/'                               ) <>  1   then bugmes();quit;end
121if regexp('cde'                                     ,'/[^ab]*/'                              ) <>  1   then bugmes();quit;end
122if regexp(''                                        ,'/abc/'                                 ) <>  []  then bugmes();quit;end
123if regexp(''                                        ,'/a*/'                                  ) <>  []  then bugmes();quit;end
124if regexp('e'                                       ,'/a|b|c|d|e/'                           ) <>  1   then bugmes();quit;end
125if regexp('abcdefg'                                 ,'/abcd*efg/'                            ) <>  1   then bugmes();quit;end
126if regexp('xabyabbbz'                               ,'/ab*/'                                 ) <>  [2 5]   then bugmes();quit;end
127if regexp('xayabbbz'                                ,'/ab*/'                              ) <>  [2 4]   then bugmes();quit;end
128if regexp('hij'                                     ,'/[abhgefdc]ij/'                        ) <>  1   then bugmes();quit;end
129if regexp('abcde'                                   ,'/^(ab|cd)e/'                           ) <>  []  then bugmes();quit;end
130if regexp('adcdcde'                                 ,'/a[bcd]*dcdcde/'                       ) <>  1   then bugmes();quit;end
131if regexp('adcdcde'                                 ,'/a[bcd]+dcdcde/'                       ) <>  []  then bugmes();quit;end
132if regexp('alpha'                                   ,'/[a-zA-Z_][a-zA-Z0-9_]*/'              ) <>  1   then bugmes();quit;end
133if regexp('effg'                                    ,'/(bc+d$|ef*g.|h?i(j|k))/'              ) <>  []  then bugmes();quit;end
134if regexp('bcdd'                                    ,'/(bc+d$|ef*g.|h?i(j|k))/'              ) <>  []  then bugmes();quit;end
135if regexp('aa'                                      ,'/((((((((((a))))))))))\10/'            ) <>  1   then bugmes();quit;end
136if regexp('aa'                                      ,'/((((((((((a))))))))))\041/'           ) <>  []  then bugmes();quit;end
137if regexp('a!'                                      ,'/((((((((((a))))))))))\041/'           ) <>  1   then bugmes();quit;end
138if regexp('a'                                       ,'/(((((((((a)))))))))/'                 ) <>  1   then bugmes();quit;end
139if regexp('uh-uh'                                   ,'/multiple words of text/'              ) <>  []  then bugmes();quit;end
140if regexp('multiple words, yeah'                    ,'/multiple words/'                      ) <>  1   then bugmes();quit;end
141if regexp('ab'                                      ,'/[k]/'                                 ) <>  []  then bugmes();quit;end
142if regexp('ac'                                      ,'/a[-]?c/'                              ) <>  1   then bugmes();quit;end
143if regexp('a'                                       ,'/(a)|\1/'                              ) <>  1   then bugmes();quit;end
144if regexp('x'                                       ,'/(a)|\1/'                              ) <>  []  then bugmes();quit;end
145if regexp('aaxabxbaxbbx'                            ,'/((\3|b)\2(a)x)+/'                     ) <>  []  then bugmes();quit;end
146if regexp('ABC'                                     ,'/abc/i'                                ) <>  1   then bugmes();quit;end
147if regexp('XBC'                                     ,'/abc/i'                                ) <>  []  then bugmes();quit;end
148if regexp('AXC'                                     ,'/abc/i'                                ) <>  []  then bugmes();quit;end
149if regexp('ABX'                                     ,'/abc/i'                                ) <>  []  then bugmes();quit;end
150if regexp('XABCY'                                   ,'/abc/i'                                ) <>  2   then bugmes();quit;end
151if regexp('ABABC'                                   ,'/abc/i'                                ) <>  3   then bugmes();quit;end
152if regexp('ABC'                                     ,'/ab*c/i'                               ) <>  1   then bugmes();quit;end
153if regexp('ABC'                                     ,'/ab*bc/i'                              ) <>  1   then bugmes();quit;end
154if regexp('ABBC'                                    ,'/ab*bc/i'                              ) <>  1   then bugmes();quit;end
155if regexp('ABBBBC'                                  ,'/ab*?bc/i'                             ) <>  1   then bugmes();quit;end
156if regexp('ABBBBC'                                  ,'/ab{0,}?bc/i'                          ) <>  1   then bugmes();quit;end
157if regexp('ABBC'                                    ,'/ab+?bc/i'                             ) <>  1   then bugmes();quit;end
158if regexp('ABC'                                     ,'/ab+bc/i'                              ) <>  []  then bugmes();quit;end
159if regexp('ABQ'                                     ,'/ab+bc/i'                              ) <>  []  then bugmes();quit;end
160if regexp('ABQ'                                     ,'/ab{1,}bc/i'                           ) <>  []  then bugmes();quit;end
161if regexp('ABBBBC'                                  ,'/ab+bc/i'                              ) <>  1   then bugmes();quit;end
162if regexp('ABBBBC'                                  ,'/ab{1,}?bc/i'                          ) <>  1   then bugmes();quit;end
163if regexp('ABBBBC'                                  ,'/ab{1,3}?bc/i'                         ) <>  1   then bugmes();quit;end
164if regexp('ABBBBC'                                  ,'/ab{3,4}?bc/i'                         ) <>  1   then bugmes();quit;end
165if regexp('ABBBBC'                                  ,'/ab{4,5}?bc/i'                         ) <>  []  then bugmes();quit;end
166if regexp('ABBC'                                    ,'/ab??bc/i'                             ) <>  1   then bugmes();quit;end
167if regexp('ABC'                                     ,'/ab??bc/i'                             ) <>  1   then bugmes();quit;end
168if regexp('ABC'                                     ,'/ab{0,1}?bc/i'                         ) <>  1   then bugmes();quit;end
169if regexp('ABBBBC'                                  ,'/ab??bc/i'                             ) <>  []  then bugmes();quit;end
170if regexp('ABC'                                     ,'/ab??c/i'                              ) <>  1   then bugmes();quit;end
171if regexp('ABC'                                     ,'/ab{0,1}?c/i'                          ) <>  1   then bugmes();quit;end
172if regexp('ABC'                                     ,'/^abc$/i'                              ) <>  1   then bugmes();quit;end
173if regexp('ABCC'                                    ,'/^abc$/i'                              ) <>  []  then bugmes();quit;end
174if regexp('ABCC'                                    ,'/^abc/i'                               ) <>  1   then bugmes();quit;end
175if regexp('AABC'                                    ,'/^abc$/i'                              ) <>  []  then bugmes();quit;end
176if regexp('AABC'                                    ,'/abc$/i'                               ) <>  2   then bugmes();quit;end
177if regexp('ABC'                                     ,'/a.c/i'                                ) <>  1   then bugmes();quit;end
178if regexp('AXC'                                     ,'/a.c/i'                                ) <>  1   then bugmes();quit;end
179if regexp('AXYZC'                                   ,'/a.*?c/i'                              ) <>  1   then bugmes();quit;end
180if regexp('AXYZD'                                   ,'/a.*c/i'                               ) <>  []  then bugmes();quit;end
181if regexp('ABC'                                     ,'/a[bc]d/i'                             ) <>  []  then bugmes();quit;end
182if regexp('ABD'                                     ,'/a[bc]d/i'                             ) <>  1   then bugmes();quit;end
183if regexp('ABD'                                     ,'/a[b-d]e/i'                            ) <>  []  then bugmes();quit;end
184if regexp('ACE'                                     ,'/a[b-d]e/i'                            ) <>  1   then bugmes();quit;end
185if regexp('AAC'                                     ,'/a[b-d]/i'                             ) <>  2   then bugmes();quit;end
186if regexp('A-'                                      ,'/a[-b]/i'                              ) <>  1   then bugmes();quit;end
187if regexp('A-'                                      ,'/a[b-]/i'                              ) <>  1   then bugmes();quit;end
188if regexp('A]'                                      ,'/a]/i'                                 ) <>  1   then bugmes();quit;end
189if regexp('A]B'                                     ,'/a[]]b/i'                              ) <>  1   then bugmes();quit;end
190if regexp('AED'                                     ,'/a[^bc]d/i'                            ) <>  1   then bugmes();quit;end
191if regexp('ABD'                                     ,'/a[^bc]d/i'                            ) <>  []  then bugmes();quit;end
192if regexp('ADC'                                     ,'/a[^-b]c/i'                            ) <>  1   then bugmes();quit;end
193if regexp('A-C'                                     ,'/a[^-b]c/i'                            ) <>  []  then bugmes();quit;end
194if regexp('A]C'                                     ,'/a[^]b]c/i'                            ) <>  []  then bugmes();quit;end
195if regexp('ADC'                                     ,'/a[^]b]c/i'                            ) <>  1   then bugmes();quit;end
196if regexp('ABC'                                     ,'/ab|cd/i'                              ) <>  1   then bugmes();quit;end
197if regexp('ABCD'                                    ,'/ab|cd/i'                              ) <>  1   then bugmes();quit;end
198if regexp('B'                                       ,'/$b/i'                                 ) <>  []  then bugmes();quit;end
199if regexp('AB'                                      ,'/a\(*b/i'                              ) <>  1   then bugmes();quit;end
200if regexp('A((B'                                    ,'/a\(*b/i'                              ) <>  1   then bugmes();quit;end
201if regexp('AABBABC'                                 ,'/a+b+c/i'                              ) <>  5   then bugmes();quit;end
202if regexp('AABBABC'                                 ,'/a{1,}b{1,}c/i'                        ) <>  5   then bugmes();quit;end
203if regexp('ABCABC'                                  ,'/a.+?c/i'                              ) <>  [1 4]   then bugmes();quit;end
204if regexp('ABCABC'                                  ,'/a.*?c/i'                              ) <>  1   then bugmes();quit;end
205if regexp('ABCABC'                                  ,'/a.{0,5}?c/i'                          ) <>  1   then bugmes();quit;end
206if regexp('CDE'                                     ,'/[^ab]*/i'                             ) <>  1   then bugmes();quit;end
207if regexp(''                                        ,'/abc/i'                                ) <>  []  then bugmes();quit;end
208if regexp(''                                        ,'/a*/i'                                 ) <>  []  then bugmes();quit;end
209if regexp('E'                                       ,'/a|b|c|d|e/i'                          ) <>  1   then bugmes();quit;end
210if regexp('ABCDEFG'                                 ,'/abcd*efg/i'                           ) <>  1   then bugmes();quit;end
211if regexp('XABYABBBZ'                               ,'/ab*/i'                                ) <>  [2 5]   then bugmes();quit;end
212if regexp('XAYABBBZ'                                ,'/ab*/i'                                ) <>  [2 4]   then bugmes();quit;end
213if regexp('HIJ'                                     ,'/[abhgefdc]ij/i'                       ) <>  1   then bugmes();quit;end
214if regexp('ABCDE'                                   ,'/^(ab|cd)e/i'                          ) <>  []  then bugmes();quit;end
215if regexp('ADCDCDE'                                 ,'/a[bcd]*dcdcde/i'                      ) <>  1   then bugmes();quit;end
216if regexp('ADCDCDE'                                 ,'/a[bcd]+dcdcde/i'                      ) <>  []  then bugmes();quit;end
217if regexp('ALPHA'                                   ,'/[a-zA-Z_][a-zA-Z0-9_]*/i'             ) <>  1   then bugmes();quit;end
218if regexp('EFFG'                                    ,'/(bc+d$|ef*g.|h?i(j|k))/i'             ) <>  []  then bugmes();quit;end
219if regexp('BCDD'                                    ,'/(bc+d$|ef*g.|h?i(j|k))/i'             ) <>  []  then bugmes();quit;end
220if regexp('AA'                                      ,'/((((((((((a))))))))))\10/i'           ) <>  1   then bugmes();quit;end
221if regexp('AA'                                      ,'/((((((((((a))))))))))\041/i'          ) <>  []  then bugmes();quit;end
222if regexp('A!'                                      ,'/((((((((((a))))))))))\041/i'          ) <>  1   then bugmes();quit;end
223if regexp('A'                                       ,'/(((((((((a)))))))))/i'                ) <>  1   then bugmes();quit;end
224if regexp('UH-UH'                                   ,'/multiple words of text/i'             ) <>  []  then bugmes();quit;end
225if regexp('MULTIPLE WORDS, YEAH'                    ,'/multiple words/i'                     ) <>  1   then bugmes();quit;end
226if regexp('AB'                                      ,'/[k]/i'                                ) <>  []  then bugmes();quit;end
227if regexp('AC'                                      ,'/a[-]?c/i'                             ) <>  1   then bugmes();quit;end
228if regexp('abad'                                    ,'/a(?!b)./'                             ) <>  3   then bugmes();quit;end
229if regexp('abad'                                    ,'/a(?=d)./'                             ) <>  3   then bugmes();quit;end
230if regexp('abad'                                    ,'/a(?=c|d)./'                           ) <>  3   then bugmes();quit;end
231if regexp('<&OUT'                                   ,'/^[<>]&/'                              ) <>  1   then bugmes();quit;end
232if regexp('aaaaaaaaa'                               ,'/^(a\1?){4}$/'                         ) <>  []  then bugmes();quit;end
233if regexp('aaaaaaaaaaa'                             ,'/^(a\1?){4}$/'                         ) <>  []  then bugmes();quit;end
234if regexp('aaaaaaaaa'                               ,'/^(a(?(1)\1)){4}$/'                    ) <>  []  then bugmes();quit;end
235if regexp('aaaaaaaaaaa'                             ,'/^(a(?(1)\1)){4}$/'                    ) <>  []  then bugmes();quit;end
236if regexp('ab'                                      ,'/(?<=a)b/'                             ) <>  2   then bugmes();quit;end
237if regexp('cb'                                      ,'/(?<=a)b/'                             ) <>  []  then bugmes();quit;end
238if regexp('b'                                       ,'/(?<=a)b/'                             ) <>  []  then bugmes();quit;end
239if regexp('ab'                                      ,'/(?<!c)b/'                             ) <>  2   then bugmes();quit;end
240if regexp('cb'                                      ,'/(?<!c)b/'                             ) <>  []  then bugmes();quit;end
241if regexp('b'                                       ,'/(?<!c)b/'                             ) <>  1   then bugmes();quit;end
242if regexp('b'                                       ,'/(?<!c)b/'                             ) <>  1   then bugmes();quit;end
243if regexp('aba'                                     ,'/(?:..)*a/'                            ) <>  1   then bugmes();quit;end
244if regexp('aba'                                     ,'/(?:..)*?a/'                           ) <>  1   then bugmes();quit;end
245if regexp('abc'                                     ,'/^(?:b|a(?=(.)))*\1/'                  ) <>  1   then bugmes();quit;end
246if regexp('ab'                                      ,'/(?:(?i)a)b/'                          ) <>  1   then bugmes();quit;end
247if regexp('Ab'                                      ,'/(?:(?i)a)b/'                          ) <>  1   then bugmes();quit;end
248if regexp('aB'                                      ,'/(?:(?i)a)b/'                          ) <>  []  then bugmes();quit;end
249if regexp('aB'                                      ,'/((?i)a)b/'                            ) <>  []  then bugmes();quit;end
250if regexp('ab'                                      ,'/(?i:a)b/'                             ) <>  1   then bugmes();quit;end
251if regexp('Ab'                                      ,'/(?i:a)b/'                             ) <>  1   then bugmes();quit;end
252if regexp('aB'                                      ,'/(?i:a)b/'                             ) <>  []  then bugmes();quit;end
253if regexp('aB'                                      ,'/((?i:a))b/'                           ) <>  []  then bugmes();quit;end
254if regexp('ab'                                      ,'/(?:(?-i)a)b/i'                        ) <>  1   then bugmes();quit;end
255if regexp('aB'                                      ,'/(?:(?-i)a)b/i'                        ) <>  1   then bugmes();quit;end
256if regexp('Ab'                                      ,'/(?:(?-i)a)b/i'                        ) <>  []  then bugmes();quit;end
257if regexp('Ab'                                      ,'/((?-i)a)b/i'                          ) <>  []  then bugmes();quit;end
258if regexp('aB'                                      ,'/(?:(?-i)a)b/i'                        ) <>  1   then bugmes();quit;end
259if regexp('AB'                                      ,'/(?:(?-i)a)b/i'                        ) <>  []  then bugmes();quit;end
260if regexp('AB'                                      ,'/((?-i)a)b/i'                          ) <>  []  then bugmes();quit;end
261if regexp('ab'                                      ,'/(?-i:a)b/i'                           ) <>  1   then bugmes();quit;end
262if regexp('aB'                                      ,'/(?-i:a)b/i'                           ) <>  1   then bugmes();quit;end
263if regexp('Ab'                                      ,'/(?-i:a)b/i'                           ) <>  []  then bugmes();quit;end
264if regexp('Ab'                                      ,'/((?-i:a))b/i'                         ) <>  []  then bugmes();quit;end
265if regexp('aB'                                      ,'/(?-i:a)b/i'                           ) <>  1   then bugmes();quit;end
266if regexp('AB'                                      ,'/(?-i:a)b/i'                           ) <>  []  then bugmes();quit;end
267if regexp('AB'                                      ,'/((?-i:a))b/i'                         ) <>  []  then bugmes();quit;end
268if regexp('a'+lf+'B'                                ,'/((?-i:a.))b/i'                        ) <>  []  then bugmes();quit;end
269if regexp('B'+lf+'B'                                ,'/((?s-i:a.))b/i'                       ) <>  []  then bugmes();quit;end
270if regexp('cabbbb'                                  ,'/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/') <>  1   then bugmes();quit;end
271if regexp('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb','/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/') <>  1   then bugmes();quit;end
272if regexp('foobar1234baz'                           ,'/foo\w*\d{4}baz/'                      ) <>  1   then bugmes();quit;end
273if regexp('x~~'                                     ,'/x(~~)*(?:(?:F)?)?/'                   ) <>  1   then bugmes();quit;end
274if regexp('aaac'                                    ,'/^a(?#xxx){3}c/'                       ) <>  1   then bugmes();quit;end
275if regexp('aaac'                                    ,'/^a (?#xxx) (?#yyy) {3}c/x'            ) <>  1   then bugmes();quit;end
276if regexp('dbcb'                                    ,'/(?<![cd])b/'                          ) <>  []  then bugmes();quit;end
277if regexp('dbaacb'                                  ,'/(?<![cd])[ab]/'                       ) <>  [3 4]   then bugmes();quit;end
278if regexp('dbcb'                                    ,'/(?<!(c|d))b/'                         ) <>  []  then bugmes();quit;end
279if regexp('dbaacb'                                  ,'/(?<!(c|d))[ab]/'                      ) <>  [3 4]   then bugmes();quit;end
280if regexp('cdaccb'                                  ,'/(?<!cd)[ab]/'                         ) <>  6   then bugmes();quit;end
281if regexp('a--'                                     ,'/^(?:a?b?)*$/'                         ) <>  []  then bugmes();quit;end
282if regexp('a'+lf+'b'+lf                             ,'/(?m)^b/'                              ) <>  [3 4]   then bugmes();quit;end
283if regexp('a'+lf+'b'+lf+'c'+lf                      ,'/^b/'                                  ) <>  []  then bugmes();quit;end
284if regexp('a'+lf+'b'+lf+'c'+lf                      ,'/()^b/'                                ) <>  []  then bugmes();quit;end
285if regexp('a'                                       ,'/(x)?(?(1)a|b)/'                       ) <>  []  then bugmes();quit;end
286if regexp('a'                                       ,'/(x)?(?(1)b|a)/'                       ) <>  1   then bugmes();quit;end
287if regexp('a'                                       ,'/()?(?(1)b|a)/'                        ) <>  1   then bugmes();quit;end
288if regexp('a'                                       ,'/()(?(1)b|a)/'                         ) <>  []  then bugmes();quit;end
289if regexp('a'                                       ,'/()?(?(1)a|b)/'                        ) <>  1   then bugmes();quit;end
290if regexp('blah)'                                   ,'/^(\()?blah(?(1)(\)))$/'               ) <>  []  then bugmes();quit;end
291if regexp('(blah'                                   ,'/^(\()?blah(?(1)(\)))$/'               ) <>  []  then bugmes();quit;end
292if regexp('blah)'                                   ,'/^(\(+)?blah(?(1)(\)))$/'              ) <>  []  then bugmes();quit;end
293if regexp('(blah'                                   ,'/^(\(+)?blah(?(1)(\)))$/'              ) <>  []  then bugmes();quit;end
294if regexp('a'                                       ,'/(?(?!a)a|b)/'                         ) <>  []  then bugmes();quit;end
295if regexp('a'                                       ,'/(?(?!a)b|a)/'                         ) <>  1   then bugmes();quit;end
296if regexp('a'                                       ,'/(?(?=a)b|a)/'                         ) <>  []  then bugmes();quit;end
297if regexp('a'                                       ,'/(?(?=a)a|b)/'                         ) <>  1   then bugmes();quit;end
298if regexp('aaab'                                    ,'/^(?=(a+?))\1ab/'                      ) <>  []  then bugmes();quit;end
299if regexp('aaab'                                    ,'/^(?=(a+?))\1ab/'                      ) <>  []  then bugmes();quit;end
300if regexp('abcd:'                                   ,'/([\w:]+::)?(\w+)$/'                   ) <>  []  then bugmes();quit;end
301if regexp('abcd:'                                   ,'/([\w:]+::)?(\w+)$/'                   ) <>  []  then bugmes();quit;end
302if regexp('aaab'                                    ,'/(>a+)ab/'                             ) <>  []  then bugmes();quit;end
303if regexp('aaab'                                    ,'/(?>a+)b/'                             ) <>  1   then bugmes();quit;end
304if regexp('abc'                                     ,'/[a[:]b[:c]/'                          ) <>  1   then bugmes();quit;end
305if regexp('abc'                                     ,'/[a[:]b[:c]/'                          ) <>  1   then bugmes();quit;end
306if regexp('((abc(ade)ufh()()x'                      ,'/((?>[^()]+)|\([^()]*\))+/'            ) <>  3   then bugmes();quit;end
307//===================================================================
308if regexp('a'+lf+'b'+lf                             ,'/a\Z/'                                 ) <>  []  then bugmes();quit;end
309if regexp('a'+lf+'b'+lf                             ,'/a\z/'                                 ) <>  []  then bugmes();quit;end
310if regexp('a'+lf+'b'+lf                             ,'/a$/'                                  ) <>  []  then bugmes();quit;end
311if regexp('b'+lf+'a'+lf                             ,'/a\z/'                                 ) <>  []  then bugmes();quit;end
312if regexp('a'+lf+'b'+lf                             ,'/a\Z/m'                                ) <>  []  then bugmes();quit;end
313if regexp('a'+lf+'b'+lf                             ,'/a\z/m'                                ) <>  []  then bugmes();quit;end
314if regexp('b'+lf+'a'+lf                             ,'/a\z/m'                                ) <>  []  then bugmes();quit;end
315if regexp('aa'+lf+'b'+lf                            ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
316if regexp('aa'+lf+'b'+lf                            ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
317if regexp('aa'+lf+'b'+lf                            ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
318if regexp('b'+lf+'aa'+lf                            ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
319if regexp('aa'+lf+'b'+lf                            ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
320if regexp('aa'+lf+'b'+lf                            ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
321if regexp('b'+lf+'aa'+lf                            ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
322if regexp('ac'+lf+'b'+lf                            ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
323if regexp('ac'+lf+'b'+lf                            ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
324if regexp('ac'+lf+'b'+lf                            ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
325if regexp('b'+lf+'ac'+lf                            ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
326if regexp('b'+lf+'ac'+lf                            ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
327if regexp('b'+lf+'ac'+lf                            ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
328if regexp('b'+lf+'ac'                               ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
329if regexp('b'+lf+'ac'                               ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
330if regexp('b'+lf+'ac'                               ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
331if regexp('ac'+lf+'b'+lf                            ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
332if regexp('ac'+lf+'b'+lf                            ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
333if regexp('ac'+lf+'b'+lf                            ,'/aa$/m'                                ) <>  []  then bugmes();quit;end
334if regexp('b'+lf+'ac'+lf                            ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
335if regexp('b'+lf+'ac'+lf                            ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
336if regexp('b'+lf+'ac'+lf                            ,'/aa$/m'                                ) <>  []  then bugmes();quit;end
337if regexp('b'+lf+'ac'                               ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
338if regexp('b'+lf+'ac'                               ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
339if regexp('b'+lf+'ac'                               ,'/aa$/m'                                ) <>  []  then bugmes();quit;end
340if regexp('ca'+lf+'b'+lf                            ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
341if regexp('ca'+lf+'b'+lf                            ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
342if regexp('ca'+lf+'b'+lf                            ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
343if regexp('b'+lf+'ca'+lf                            ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
344if regexp('b'+lf+'ca'+lf                            ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
345if regexp('b'+lf+'ca'+lf                            ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
346if regexp('b'+lf+'ca'                               ,'/aa\Z/'                                ) <>  []  then bugmes();quit;end
347if regexp('b'+lf+'ca'                               ,'/aa\z/'                                ) <>  []  then bugmes();quit;end
348if regexp('b'+lf+'ca'                               ,'/aa$/'                                 ) <>  []  then bugmes();quit;end
349if regexp('ca'+lf+'b'+lf                            ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
350if regexp('ca'+lf+'b'+lf                            ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
351if regexp('ca'+lf+'b'+lf                            ,'/aa$/m'                                ) <>  []  then bugmes();quit;end
352if regexp('b'+lf+'ca'+lf                            ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
353if regexp('b'+lf+'ca'+lf                            ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
354if regexp('b'+lf+'ca'+lf                            ,'/aa$/m'                                ) <>  []  then bugmes();quit;end
355if regexp('b'+lf+'ca'                               ,'/aa\Z/m'                               ) <>  []  then bugmes();quit;end
356if regexp('b'+lf+'ca'                               ,'/aa\z/m'                               ) <>  []  then bugmes();quit;end
357if regexp('b'+lf+'ca'                               ,'/aa$/m'                                ) <>  []  then bugmes();quit;end
358if regexp('ab'+lf+'b'+lf                            ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
359if regexp('ab'+lf+'b'+lf                            ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
360if regexp('ab'+lf+'b'+lf                            ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
361if regexp('b'+lf+'ab'+lf                            ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
362if regexp('ab'+lf+'b'+lf                            ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
363if regexp('ab'+lf+'b'+lf                            ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
364if regexp('b'+lf+'ab'+lf                            ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
365if regexp('ac'+lf+'b'+lf                            ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
366if regexp('ac'+lf+'b'+lf                            ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
367if regexp('ac'+lf+'b'+lf                            ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
368if regexp('b'+lf+'ac'+lf                            ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
369if regexp('b'+lf+'ac'+lf                            ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
370if regexp('b'+lf+'ac'+lf                            ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
371if regexp('b'+lf+'ac'                               ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
372if regexp('b'+lf+'ac'                               ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
373if regexp('b'+lf+'ac'                               ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
374if regexp('ac'+lf+'b'+lf                            ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
375if regexp('ac'+lf+'b'+lf                            ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
376if regexp('ac'+lf+'b'+lf                            ,'/ab$/m'                                ) <>  []  then bugmes();quit;end
377if regexp('b'+lf+'ac'+lf                            ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
378if regexp('b'+lf+'ac'+lf                            ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
379if regexp('b'+lf+'ac'+lf                            ,'/ab$/m'                                ) <>  []  then bugmes();quit;end
380if regexp('b'+lf+'ac'                               ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
381if regexp('b'+lf+'ac'                               ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
382if regexp('b'+lf+'ac'                               ,'/ab$/m'                                ) <>  []  then bugmes();quit;end
383if regexp('ca'+lf+'b'+lf                            ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
384if regexp('ca'+lf+'b'+lf                            ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
385if regexp('ca'+lf+'b'+lf                            ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
386if regexp('b'+lf+'ca'+lf                            ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
387if regexp('b'+lf+'ca'+lf                            ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
388if regexp('b'+lf+'ca'+lf                            ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
389if regexp('b'+lf+'ca'                               ,'/ab\Z/'                                ) <>  []  then bugmes();quit;end
390if regexp('b'+lf+'ca'                               ,'/ab\z/'                                ) <>  []  then bugmes();quit;end
391if regexp('b'+lf+'ca'                               ,'/ab$/'                                 ) <>  []  then bugmes();quit;end
392if regexp('ca'+lf+'b'+lf                            ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
393if regexp('ca'+lf+'b'+lf                            ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
394if regexp('ca'+lf+'b'+lf                            ,'/ab$/m'                                ) <>  []  then bugmes();quit;end
395if regexp('b'+lf+'ca'+lf                            ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
396if regexp('b'+lf+'ca'+lf                            ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
397if regexp('b'+lf+'ca'+lf                            ,'/ab$/m'                                ) <>  []  then bugmes();quit;end
398if regexp('b'+lf+'ca'                               ,'/ab\Z/m'                               ) <>  []  then bugmes();quit;end
399if regexp('b'+lf+'ca'                               ,'/ab\z/m'                               ) <>  []  then bugmes();quit;end
400if regexp('b'+lf+'ca'                               ,'/ab$/m'                                ) <>  []  then bugmes();quit;end
401if regexp('abb'+lf+'b'+lf                           ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
402if regexp('abb'+lf+'b'+lf                           ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
403if regexp('abb'+lf+'b'+lf                           ,'/abb$/'                                ) <>  []  then bugmes();quit;end
404if regexp('b'+lf+'abb'+lf                           ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
405if regexp('abb'+lf+'b'+lf                           ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
406if regexp('abb'+lf+'b'+lf                           ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
407if regexp('b'+lf+'abb'+lf                           ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
408if regexp('ac'+lf+'b'+lf                            ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
409if regexp('ac'+lf+'b'+lf                            ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
410if regexp('ac'+lf+'b'+lf                            ,'/abb$/'                                ) <>  []  then bugmes();quit;end
411if regexp('b'+lf+'ac'+lf                            ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
412if regexp('b'+lf+'ac'+lf                            ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
413if regexp('b'+lf+'ac'+lf                            ,'/abb$/'                                ) <>  []  then bugmes();quit;end
414if regexp('b'+lf+'ac'                               ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
415if regexp('b'+lf+'ac'                               ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
416if regexp('b'+lf+'ac'                               ,'/abb$/'                                ) <>  []  then bugmes();quit;end
417if regexp('ac'+lf+'b'+lf                            ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
418if regexp('ac'+lf+'b'+lf                            ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
419if regexp('ac'+lf+'b'+lf                            ,'/abb$/m'                               ) <>  []  then bugmes();quit;end
420if regexp('b'+lf+'ac'+lf                            ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
421if regexp('b'+lf+'ac'+lf                            ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
422if regexp('b'+lf+'ac'+lf                            ,'/abb$/m'                               ) <>  []  then bugmes();quit;end
423if regexp('b'+lf+'ac'                               ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
424if regexp('b'+lf+'ac'                               ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
425if regexp('b'+lf+'ac'                               ,'/abb$/m'                               ) <>  []  then bugmes();quit;end
426if regexp('ca'+lf+'b'+lf                            ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
427if regexp('ca'+lf+'b'+lf                            ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
428if regexp('ca'+lf+'b'+lf                            ,'/abb$/'                                ) <>  []  then bugmes();quit;end
429if regexp('b'+lf+'ca'+lf                            ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
430if regexp('b'+lf+'ca'+lf                            ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
431if regexp('b'+lf+'ca'+lf                            ,'/abb$/'                                ) <>  []  then bugmes();quit;end
432if regexp('b'+lf+'ca'                               ,'/abb\Z/'                               ) <>  []  then bugmes();quit;end
433if regexp('b'+lf+'ca'                               ,'/abb\z/'                               ) <>  []  then bugmes();quit;end
434if regexp('b'+lf+'ca'                               ,'/abb$/'                                ) <>  []  then bugmes();quit;end
435if regexp('ca'+lf+'b'+lf                            ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
436if regexp('ca'+lf+'b'+lf                            ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
437if regexp('ca'+lf+'b'+lf                            ,'/abb$/m'                               ) <>  []  then bugmes();quit;end
438if regexp('b'+lf+'ca'+lf                            ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
439if regexp('b'+lf+'ca'+lf                            ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
440if regexp('b'+lf+'ca'+lf                            ,'/abb$/m'                               ) <>  []  then bugmes();quit;end
441if regexp('b'+lf+'ca'                               ,'/abb\Z/m'                              ) <>  []  then bugmes();quit;end
442if regexp('b'+lf+'ca'                               ,'/abb\z/m'                              ) <>  []  then bugmes();quit;end
443if regexp('b'+lf+'ca'                               ,'/abb$/m'                               ) <>  []  then bugmes();quit;end
444if regexp('x'                                       ,'/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/') <>  []  then bugmes();quit;end
445if regexp('foo.bart'                                ,'/foo.bart/'                            ) <>  1   then bugmes();quit;end
446if regexp('abcd'+lf+'dxxx'                          ,'/^d[x][x][x]/m'                        ) <>  6   then bugmes();quit;end
447if regexp('xxxtt'                                   ,'/tt+$/'                                ) <>  4   then bugmes();quit;end
448if regexp('aaaXbX'                                  ,'/\GX.*X/'                              ) <>  []  then bugmes();quit;end
449if regexp('Changes'                                 ,'/\.c(pp|xx|c)?$/i'                     ) <>  []  then bugmes();quit;end
450if regexp('IO.c'                                    ,'/\.c(pp|xx|c)?$/i'                     ) <>  3   then bugmes();quit;end
451if regexp('C:/'                                     ,'/^([a-z]:)/'                           ) <>  []  then bugmes();quit;end
452if regexp(lf+'x aa'                                 ,'/^\S\s+aa$/m'                          ) <>  2   then bugmes();quit;end
453[start_pos, end_pos, match_str] = regexp(lf+'x aa'                                 ,'/^\S\s+aa$/m'                          );
454if (start_pos <> 2) then bugmes();quit;end
455if (end_pos <> 5) then bugmes();quit;end
456if (match_str <> 'x aa') then bugmes();quit;end
457if regexp('ab'                                      ,'/(^|a)b/'                              ) <>  1   then bugmes();quit;end
458if regexp('abcab'                                   ,'/(\w)?(abc)\1b/'                       ) <>  []  then bugmes();quit;end
459if regexp('a,b,c'                                   ,'/^(?:.,){2}c/'                         ) <>  1   then bugmes();quit;end
460if regexp('a,b,c'                                   ,'/^(?:[^,]*,){2}c/'                     ) <>  1   then bugmes();quit;end
461if regexp(''                                        ,'/(?i)/'                                ) <>  []  then bugmes();quit;end
462if regexp('a'+lf+'xb'+lf                            ,'/(?!\A)x/m'                            ) <>  3   then bugmes();quit;end
463if regexp('123'+lf+'abcabcabcabc'+lf                ,'/^.{9}abc.*\n/m'                       ) <>  5   then bugmes();quit;end
464if regexp('a'                                       ,'/^(a)?(?(1)a|b)+$/'                    ) <>  []  then bugmes();quit;end
465if regexp('x1'                                      ,'/^(0+)?(?:x(1))?/'                     ) <>  1   then bugmes();quit;end
466if regexp('012cxx0190'                              ,'/^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/') <>  1   then bugmes();quit;end
467if regexp('aaaacccc'                                ,'/((?:aaaa|bbbb)cccc)?/'                ) <>  1   then bugmes();quit;end
468if regexp('bbbbcccc'                                ,'/((?:aaaa|bbbb)cccc)?/'                ) <>  1   then bugmes();quit;end
469if regexp('a'+lf+'b'+lf                             ,'/b\s^/m'                               ) <>  []  then bugmes();quit;end
470if regexp('a'                                       ,'/\ba/'                                 ) <>  1   then bugmes();quit;end
471if regexp('AbCd'                                    ,'/ab(?i)cd/'                            ) <>  []  then bugmes();quit;end
472if regexp('abCd'                                    ,'/ab(?i)cd/'                            ) <>  1   then bugmes();quit;end
473if regexp('Oo'                                      ,'/^(o)(?!.*\1)/i'                       ) <>  []  then bugmes();quit;end
474if regexp('2'                                       ,'/2(]*)?$\1/'                           ) <>  1   then bugmes();quit;end
475if regexp('......abef'                              ,'/.*a(?!(b|cd)*e).*f/'                  ) <>  []  then bugmes();quit;end
476if regexp('fools'                                   ,'/(foo|fool|x.|money|parted)$/'         ) <>  []  then bugmes();quit;end
477if regexp('fools'                                   ,'/(x.|foo|fool|x.|money|parted|y.)$/'   ) <>  []  then bugmes();quit;end
478if regexp('fools'                                   ,'/(foo|fool|money|parted)$/'            ) <>  []  then bugmes();quit;end
479//===================================================================
480if regexp('scilab-5.0'            ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> 1  then bugmes();quit;end
481if regexp('scilab-5.0.1'          ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> 1  then bugmes();quit;end
482if regexp('scilab-5.0-alpha-1'    ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> 1  then bugmes();quit;end
483if regexp('scilab-5.0-alpha1'     ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> [] then bugmes();quit;end
484if regexp('scilab-5.0-rc1'        ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> 1  then bugmes();quit;end
485if regexp('scilab-5.0-rc-1'       ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> [] then bugmes();quit;end
486if regexp('scilab-SE-trunk-27490' ,'/^scilab-[5-9].[0-9](.[0-9])?(-(alpha-|beta-|rc)([0-9])?)?$/') <> [] then bugmes();quit;end
487//===================================================================
488// Chinese
489str = '世界您好';
490[s,e,m] = regexp(str,'/您好$/');
491if part(str,s:e) <> m then bugmes();quit;end
492[s,e,m] = regexp(str,'/^世界/');
493if part(str,s:e) <> m then bugmes();quit;end
494[s,e,m] = regexp(str,'/世界$/');
495if s <> [] then bugmes();quit;end
496if e <> [] then bugmes();quit;end
497if m <> '' then bugmes();quit;end
498[s,e,m] = regexp(str,'/您好$/');
499if part(str,s:e) <> m then bugmes();quit;end
500[s,e,m] = regexp(str,'/^您好/');
501if s <> [] then bugmes();quit;end
502if e <> [] then bugmes();quit;end
503if m <> '' then bugmes();quit;end
504[s,e,m] = regexp(str,'/界您/');
505if part(str,s:e) <> m then bugmes();quit;end
506[s,e,m] = regexp(str,'/界_您/');
507if s <> [] then bugmes();quit;end
508if e <> [] then bugmes();quit;end
509if m <> '' then bugmes();quit;end
510//===================================================================
511// Russian
512str = 'привет мир';
513[s,e,m] = regexp(str,'/^привет/');
514if part(str,s:e) <> m then bugmes();quit;end
515[s,e,m] = regexp(str,'/привет$/');
516if s <> [] then bugmes();quit;end
517if e <> [] then bugmes();quit;end
518if m <> '' then bugmes();quit;end
519[s,e,m] = regexp(str,'/мир$/');
520if part(str,s:e) <> m then bugmes();quit;end
521[s,e,m] = regexp(str,'/^мир/');
522if s <> [] then bugmes();quit;end
523if e <> [] then bugmes();quit;end
524if m <> '' then bugmes();quit;end
525[s,e,m] = regexp(str,'/вет\sм/');
526if part(str,s:e) <> m then bugmes();quit;end
527[s,e,m] = regexp(str,'/вет_м/');
528if s <> [] then bugmes();quit;end
529if e <> [] then bugmes();quit;end
530if m <> '' then bugmes();quit;end
531//===================================================================
532// Cyrilic
533str = 'АБВГДЄЖЅЗИІКЛМНОПҀРСТѸФХѠЦЧШЩЪЪІЬѢЮѦѨѪѬѮѰѲѴѤ';
534[s,e,m] = regexp(str,'/^АБВГДЄЖЅЗИІКЛМНОПҀР/');
535if part(str,s:e) <> m then bugmes();quit;end
536[s,e,m] = regexp(str,'/АБВГДЄЖЅЗИІКЛМНОПҀР$/');
537if s <> [] then bugmes();quit;end
538if e <> [] then bugmes();quit;end
539if m <> '' then bugmes();quit;end
540[s,e,m] = regexp(str,'/ЧШЩЪЪІЬѢЮѦѨѪѬѮѰѲѴѤ$/');
541if part(str,s:e) <> m then bugmes();quit;end
542[s,e,m] = regexp(str,'/^ЧШЩЪЪІЬѢЮѦѨѪѬѮѰѲѴѤ/');
543if s <> [] then bugmes();quit;end
544if e <> [] then bugmes();quit;end
545if m <> '' then bugmes();quit;end
546[s,e,m] = regexp(str,'/ИІКЛМНОПҀРСТѸФХѠЦЧШЩЪ/');
547if part(str,s:e) <> m then bugmes();quit;end
548[s,e,m] = regexp(str,'/ИІКЛМНОПҀ_РСТѸФХѠЦЧШЩЪ/');
549if s <> [] then bugmes();quit;end
550if e <> [] then bugmes();quit;end
551if m <> '' then bugmes();quit;end
552//===================================================================
553// Japanese
554str = '丑丞串乃之乎也云亘亙些亦亥亨亮仔伊伎伍伽佃佑伶侃侑俄侠俣俐侶倭俺倶倦倖偲僅傭儲允兎兜其冥冴冶凄凌凜凛凧凪凰凱函刹劉劫勁勃';
555[s,e,m] = regexp(str,'/^丑丞串乃之乎也云亘亙些亦/');
556if part(str,s:e) <> m then bugmes();quit;end
557[s,e,m] = regexp(str,'/丑丞串乃之乎也云亘亙些亦$/');
558if s <> [] then bugmes();quit;end
559if e <> [] then bugmes();quit;end
560if m <> '' then bugmes();quit;end
561[s,e,m] = regexp(str,'/凰凱函刹劉劫勁勃$/');
562if part(str,s:e) <> m then bugmes();quit;end
563[s,e,m] = regexp(str,'/^凰凱函刹劉劫勁勃/');
564if s <> [] then bugmes();quit;end
565if e <> [] then bugmes();quit;end
566if m <> '' then bugmes();quit;end
567[s,e,m] = regexp(str,'/亨亮仔伊伎伍伽佃佑伶侃/');
568if part(str,s:e) <> m then bugmes();quit;end
569[s,e,m] = regexp(str,'/亨亮仔伊_伎伍伽佃佑伶侃/');
570if s <> [] then bugmes();quit;end
571if e <> [] then bugmes();quit;end
572if m <> '' then bugmes();quit;end
573//===================================================================
574// Thaï
575str = 'มกระดุกกระดิก';
576[s,e,m] = regexp(str,'/^มกระดุกกร/');
577if part(str,s:e) <> m then bugmes();quit;end
578[s,e,m] = regexp(str,'/มกระดุกกร$/');
579if s <> [] then bugmes();quit;end
580if e <> [] then bugmes();quit;end
581if m <> '' then bugmes();quit;end
582[s,e,m] = regexp(str,'/กกระดิก$/');
583if part(str,s:e) <> m then bugmes();quit;end
584[s,e,m] = regexp(str,'/^กกระดิก/');
585if s <> [] then bugmes();quit;end
586if e <> [] then bugmes();quit;end
587if m <> '' then bugmes();quit;end
588[s,e,m] = regexp(str,'/ดุกก/');
589if part(str,s:e) <> m then bugmes();quit;end
590[s,e,m] = regexp(str,'/ดุก_ก/');
591if s <> [] then bugmes();quit;end
592if e <> [] then bugmes();quit;end
593if m <> '' then bugmes();quit;end
594//===================================================================
595// Subpatterns
596piString="3.14";
597[a,b,c,piStringSplit]=regexp(piString,"/(\d+)\.(\d+)/");
598assert_checkequal(piStringSplit(1),"3");
599assert_checkequal(piStringSplit(2),"14");
600[a,b,c,d]=regexp('xabyabbbz','/ab(.*)b(.*)/');
601assert_checkequal(size(d), [1, 2]);
602// get host name from URL
603myURL="http://www.scilab.org/download/";
604[a,b,c,d]=regexp(myURL,'@^(?:http://)?([^/]+)@i');
605assert_checkequal(d,"www.scilab.org");
606str='foobar: 2012';
607// Using named subpatterns
608[a,b,c,d]=regexp(str,'/(?P<name>\w+): (?P<digit>\d+)/');
609assert_checkequal(d(1),"foobar");
610assert_checkequal(d(2),"2012");
611