-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregex.java
582 lines (577 loc) · 39.3 KB
/
regex.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class regex{
public static void main(String[] args) {
String regex = "(.*?)<div class=\\\"summary\\\">(.|\\n)*?<div class=\\\"started fr\\\">";
String string = "</header>\n\n"
+ " <script>\n"
+ " StackExchange.ready(function() { StackExchange.topbar.init(); });\n"
+ " StackExchange.scrollPadding.setPaddingTop(60, 10); </script>\n\n\n\n"
+ " <div class=\"container\">\n"
+ " \n\n\n"
+ " <div id=\"content\" class=\"snippet-hidden\">\n\n\n"
+ " \n\n"
+ "<div id=\"mainbar\">\n"
+ " <div class=\"subheader search-header\">\n"
+ " <h1>Search</h1>\n"
+ " </div>\n\n"
+ " <div class=\"displaying-results\">\n"
+ " <span class=\"mr2\">\n"
+ "results found containing <span class=\"displaying-results--highlight\">php socket</span> </span>\n"
+ " </div>\n\n"
+ " <form id=\"bigsearch\" action=\"/search\" method=\"get\">\n"
+ " <table>\n"
+ " <tr>\n"
+ " <td class=\"col1\"><input name=\"q\" class=\"textbox\" type=\"text\" maxlength=\"140\" size=\"80\" value=\"php socket\"></td>\n"
+ " <td class=\"col2\"><input type=\"submit\" value=\"search\"/></td>\n"
+ " </tr>\n"
+ " </table>\n"
+ " </form>\n\n\n"
+ " <div class=\"subheader results-header\">\n"
+ " <h2>8,683 <span class=\"results-label\">results</span></h2>\n"
+ " \n"
+ "<div id=\"tabs\">\n"
+ " <a href=\"/search?tab=relevance&q=php%20socket\" data-nav-xhref=\"\" title=\"Search results with best match to search terms\" data-value=\"relevance\" data-shortcut=\"\">\n"
+ " relevance</a>\n"
+ " <a href=\"/search?tab=newest&q=php%20socket\" data-nav-xhref=\"\" title=\"Newest search results\" data-value=\"newest\" data-shortcut=\"\">\n"
+ " newest</a>\n"
+ " <a class=\"youarehere \" href=\"/search?tab=votes&q=php%20socket\" data-nav-xhref=\"\" title=\"Highest voted search results\" data-value=\"votes\" data-shortcut=\"\">\n"
+ " votes</a>\n"
+ " <a href=\"/search?tab=active&q=php%20socket\" data-nav-xhref=\"\" title=\"Recently active search results\" data-value=\"active\" data-shortcut=\"\">\n"
+ " active</a>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"search-results js-search-results\">\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-4113570\" data-position=\"1\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>1190</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/4113299/ruby-on-rails-server-options/4113570#4113570\" data-searchsession=\"/questions/4113299/ruby-on-rails-server-options/4113570?s=1|0.0000#4113570\" title=\"Ruby on Rails Server options\">\n"
+ " A: Ruby on Rails Server options\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " written in <span class=\"result-highlight\">PHP</span>. Apache is more popular and has more features, Nginx is smaller and faster and has less features.\n\n"
+ "Neither Apache nor Nginx can serve Ruby web apps out-of-the-box, to do that you need to use … .\n"
+ "Sets up a TCP <span class=\"result-highlight\">socket</span>, allowing it to communicate with the outside world (e.g. the Internet). \n"
+ "Mongrel listens for HTTP requests on this <span class=\"result-highlight\">socket</span> and passes the request data to the Ruby web app. \n"
+ "The Ruby … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-ruby-on-rails t-apache t-passenger t-mongrel\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2010-11-06 14:50:25Z\" class=\"relativetime\">Nov 6 '10</span> by <a href=\"/users/20816/hongli\">Hongli</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"question-summary-2089271\" data-position=\"2\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>681</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"status answered-accepted\">\n"
+ " <strong>12</strong>answers\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/2089271/what-is-common-gateway-interface-cgi\" data-searchsession=\"/questions/2089271/what-is-common-gateway-interface-cgi?s=2|0.0000\" title=\"What is Common Gateway Interface (CGI)?\">\n"
+ "Q: What is Common Gateway Interface (CGI)? </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " time I encountered this word. But frankly, I didn't. I'm still confused. \n\n"
+ "I am a <span class=\"result-highlight\">PHP</span> programmer with web development experience. \n\n\n"
+ " user (client) request for page ---> webserver(->embedded <span class=\"result-highlight\">PHP</span> … \n"
+ " interpreter) ----> Server side(<span class=\"result-highlight\">PHP</span>) Script ---> MySQL Server.\n\n\n"
+ "Now say my <span class=\"result-highlight\">PHP</span> Script can fetch results from MySQL server & MATLAB server & some other server.\n\n"
+ "So, now <span class=\"result-highlight\">PHP</span> Script is the CGI? Because its … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-cgi\">\n"
+ "<a href=\"/questions/tagged/cgi\" class=\"post-tag\" title=\"show questions tagged 'cgi'\" rel=\"tag\">cgi</a> </div>\n"
+ " <div class=\"started fr\">\n"
+ "asked <span title=\"2010-01-18 21:15:48Z\" class=\"relativetime\">Jan 18 '10</span> by <a href=\"/users/193653/claws\">claws</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-6782438\" data-position=\"3\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>620</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/1884724/what-is-node-js/6782438#6782438\" data-searchsession=\"/questions/1884724/what-is-node-js/6782438?s=3|0.0000#6782438\" title=\"What is Node.js?\">\n"
+ " A: What is Node.js?\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " incoming connections and do all the stuff that Apache does for <span class=\"result-highlight\">PHP</span>. To be fair, Ruby on Rails has this exact problem. It is solved via two complementary mechanisms: 1) Putting Ruby on Rails/Node.js behind … -per-request model (LAMP):\n\n\n"
+ "Pro: Scalable to thousands of active connections. Very fast and very efficient. For a web fleet, this could mean a 10X reduction in the number of boxes required versus <span class=\"result-highlight\">PHP</span> … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-javascript t-nodeûjs t-v8 t-evented-io\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2011-07-21 20:37:07Z\" class=\"relativetime\">Jul 21 '11</span> by <a href=\"/users/407731/dave-dopson\">Dave Dopson</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-5978844\" data-position=\"4\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>571</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/1623914/what-is-thread-safe-or-non-thread-safe-in-php/5978844#5978844\" data-searchsession=\"/questions/1623914/what-is-thread-safe-or-non-thread-safe-in-php/5978844?s=4|0.0000#5978844\" title=\"What is thread safe or non-thread safe in PHP?\">\n"
+ " A: What is thread safe or non-thread safe in PHP?\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " concerned with the two models above, and taking Apache HTTP server as an example.\n\n"
+ "Needed background on how <span class=\"result-highlight\">PHP</span> "integrates" with web servers:\n\n"
+ "<span class=\"result-highlight\">PHP</span> itself does not respond to the actual HTTP requests … -- this is the job of the web server. So we configure the web server to forward requests to <span class=\"result-highlight\">PHP</span> for processing, then receive the result and send it back to the user. There are multiple ways to chain the … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-php t-multithreading t-thread-safety t-packages t-threadcontext\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2011-05-12 13:37:56Z\" class=\"relativetime\">May 12 '11</span> by <a href=\"/users/43597/amr-mostafa\">Amr Mostafa</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-23487409\" data-position=\"5\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>553</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/23443398/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied/23487409#23487409\" data-searchsession=\"/questions/23443398/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied/23487409?s=5|0.0000#23487409\" title=\"nginx error connect to php5-fpm.sock failed (13: Permission denied)\">\n"
+ " A: nginx error connect to php5-fpm.sock failed (13: Permission denied)\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " I had a similar error after <span class=\"result-highlight\">php</span> update. <span class=\"result-highlight\">PHP</span> fixed a security bug where o had rw permission to the <span class=\"result-highlight\">socket</span> file.\n\n\n"
+ "Open /etc/php5/fpm/pool.d/www.conf or /etc/<span class=\"result-highlight\">php</span>/7.0/fpm/pool.d/www.conf, depending on … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-unix t-nginx t-php\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2014-05-06 06:30:09Z\" class=\"relativetime\">May 6 '14</span> by <a href=\"/users/3606896/xander\">Xander</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-10029326\" data-position=\"6\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>465</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/10028770/in-what-situations-would-ajax-long-short-polling-be-preferred-over-html5-websock/10029326#10029326\" data-searchsession=\"/questions/10028770/in-what-situations-would-ajax-long-short-polling-be-preferred-over-html5-websock/10029326?s=6|0.0000#10029326\" title=\"In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?\">\n"
+ " A: In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " huge performance and architecture advantages. For example, in node.js, you can share the same memory for different <span class=\"result-highlight\">socket</span> connections, so they can each access shared variables. Therefore, you don't need … to use a database as an exchange point in the middle (like with AJAX or Long Polling with a language like <span class=\"result-highlight\">PHP</span>).\n"
+ "You can store data in RAM, or even republish between sockets straight away.\n\n"
+ "Security … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-javascript t-ajax t-html5 t-websocket t-network-protocols\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2012-04-05 13:15:07Z\" class=\"relativetime\">Apr 5 '12</span> by <a href=\"/users/1312722/moka\">moka</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"question-summary-10873295\" data-position=\"7\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>445</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"status answered-accepted\">\n"
+ " <strong>33</strong>answers\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server\" data-searchsession=\"/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server?s=7|0.0000\" title=\"Error message "Forbidden You don't have permission to access / on this server"\">\n"
+ "Q: Error message “Forbidden You don't have permission to access / on this server” </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " modules/mod_vhost_alias.so\n"
+ "LoadModule php5_module "c:/Program Files/<span class=\"result-highlight\">php</span>/php5apache2_2.dll" \n\n"
+ "<IfModule !mpm_netware_module>\n"
+ "<IfModule !mpm_winnt_module>\n"
+ "#\n"
+ "# If you wish httpd to run as a different … Software Foundation/Apache2.2/cgi-bin/"\n\n"
+ "</IfModule>\n\n"
+ "<IfModule cgid_module>\n"
+ " #\n"
+ " # ScriptSock: On threaded servers, designate the path to the UNIX\n"
+ " # <span class=\"result-highlight\">socket</span> used to communicate with the CGI daemon … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-apache t-configuration t-httpdûconf t-http-status-code-403\">\n"
+ "<a href=\"/questions/tagged/apache\" class=\"post-tag\" title=\"show questions tagged 'apache'\" rel=\"tag\">apache</a> <a href=\"/questions/tagged/configuration\" class=\"post-tag\" title=\"show questions tagged 'configuration'\" rel=\"tag\">configuration</a> <a href=\"/questions/tagged/httpd.conf\" class=\"post-tag\" title=\"show questions tagged 'httpd.conf'\" rel=\"tag\">httpd.conf</a> <a href=\"/questions/tagged/http-status-code-403\" class=\"post-tag\" title=\"show questions tagged 'http-status-code-403'\" rel=\"tag\">http-status-code-403</a> </div>\n"
+ " <div class=\"started fr\">\n"
+ "asked <span title=\"2012-06-03 19:30:34Z\" class=\"relativetime\">Jun 3 '12</span> by <a href=\"/users/1108484/dmytro-zarezenko\">Dmytro Zarezenko</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-2700609\" data-position=\"8\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>421</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/1253683/what-browsers-support-html5-websocket-api/2700609#2700609\" data-searchsession=\"/questions/1253683/what-browsers-support-html5-websocket-api/2700609?s=8|0.0000#2700609\" title=\"What browsers support HTML5 WebSocket API?\">\n"
+ " A: What browsers support HTML5 WebSocket API?\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " \n\n\n"
+ "In <span class=\"result-highlight\">PHP</span>:\n\n\n"
+ "Ratchet\n"
+ "phpwebsocket.\n"
+ "Extendible Web <span class=\"result-highlight\">Socket</span> Server\n"
+ "phpdaemon\n\n\n"
+ "In Python:\n\n\n"
+ "pywebsockets\n"
+ "websockify\n"
+ "gevent-websocket, gevent-socketio and flask-sockets based on the former\n"
+ "Autobahn\n"
+ "Tornado … support WebSocket using the web-<span class=\"result-highlight\">socket</span>-js shim/polyfill.\n\n"
+ "See caniuse for the current status of WebSockets support in desktop and mobile browsers.\n\n"
+ "See the test reports from the WS testsuite included in … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-javascript t-web-applications t-html5 t-network-programming t-websocket\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2010-04-23 17:26:10Z\" class=\"relativetime\">Apr 23 '10</span> by <a href=\"/users/317336/cbe317\">Cbe317</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-2089297\" data-position=\"9\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>382</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/2089271/what-is-common-gateway-interface-cgi/2089297#2089297\" data-searchsession=\"/questions/2089271/what-is-common-gateway-interface-cgi/2089297?s=9|0.0000#2089297\" title=\"What is Common Gateway Interface (CGI)?\">\n"
+ " A: What is Common Gateway Interface (CGI)?\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " your case you most likely used another, specific for <span class=\"result-highlight\">PHP</span>, means of communication between your scripts and the webserver, this, as you well mention in your question, is an embedded interpreter called … all the time I keep hearing these two in combination "CGI & Perl". This book is another great example CGI Programming with Perl Why not "CGI Programming with <span class=\"result-highlight\">PHP</span>/JSP/ASP". I never saw such things … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-cgi\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2010-01-18 21:20:13Z\" class=\"relativetime\">Jan 18 '10</span> by <a href=\"/users/5190/vinko-vrsalovic\">Vinko Vrsalovic</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-1687696\" data-position=\"10\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>344</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/731233/activemq-or-rabbitmq-or-zeromq-or/1687696#1687696\" data-searchsession=\"/questions/731233/activemq-or-rabbitmq-or-zeromq-or/1687696?s=10|0.0000#1687696\" title=\"ActiveMQ or RabbitMQ or ZeroMQ or\">\n"
+ " A: ActiveMQ or RabbitMQ or ZeroMQ or\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " :-).\n\n"
+ "Finally, all 3 products:\n\n\n"
+ "have client apis for the most common languages (C++, Java, .Net, Python, <span class=\"result-highlight\">Php</span>, Ruby, …)\n"
+ "have strong documentation\n"
+ "are actively supported\n\n"
+ " … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-jms t-rabbitmq t-activemq t-message-queue t-zeromq\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2009-11-06 13:46:28Z\" class=\"relativetime\">Nov 6 '09</span> by <a href=\"/users/186187/julien\">Julien</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-2886224\" data-position=\"11\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>239</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/1175096/how-to-find-out-if-youre-using-https-without-serverhttps/2886224#2886224\" data-searchsession=\"/questions/1175096/how-to-find-out-if-youre-using-https-without-serverhttps/2886224?s=11|0.0000#2886224\" title=\"How to find out if you're using HTTPS without $_SERVER['HTTPS']\">\n"
+ " A: How to find out if you're using HTTPS without $_SERVER['HTTPS']\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " using ISAPI with IIS, the value will be "off" if the request was not made through the HTTPS protocol. (Same behaviour has been reported for IIS7 running <span class=\"result-highlight\">PHP</span> as a Fast-CGI application).\n\n\n"
+ "Also, Apache … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-php t-https\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2010-05-21 23:26:38Z\" class=\"relativetime\">May 21 '10</span> by <a href=\"/users/289317/gras-double\">Gras Double</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-9046775\" data-position=\"12\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>157</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/9046675/convert-a-php-script-into-a-stand-alone-windows-executable/9046775#9046775\" data-searchsession=\"/questions/9046675/convert-a-php-script-into-a-stand-alone-windows-executable/9046775?s=12|0.0000#9046775\" title=\"Convert a PHP script into a stand-alone windows executable\">\n"
+ " A: Convert a PHP script into a stand-alone windows executable\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " (created using for example the WinBinder library). It's also good for making stand-alone <span class=\"result-highlight\">PHP</span> <span class=\"result-highlight\">Socket</span> servers/clients (using the php_sockets.dll extension). \n"
+ "It's NOT really a compiler in the sense that it … Peachpie\n\n"
+ "http://www.peachpie.io\n\n"
+ "https://github.com/iolevel/peachpie\n\n"
+ "Peachpie is <span class=\"result-highlight\">PHP</span> 7 compiler based on Roslyn by Microsoft and drawing from popular Phalanger. It allows <span class=\"result-highlight\">PHP</span> to be executed within … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-compiler-construction t-obfuscation t-php\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2012-01-28 16:20:54Z\" class=\"relativetime\">Jan 28 '12</span> by <a href=\"/users/324584/mark-baker\">Mark Baker</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-5031720\" data-position=\"13\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>154</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/4815226/how-to-design-a-multi-user-ajax-web-application-to-be-concurrently-safe/5031720#5031720\" data-searchsession=\"/questions/4815226/how-to-design-a-multi-user-ajax-web-application-to-be-concurrently-safe/5031720?s=13|0.0000#5031720\" title=\"How to design a multi-user ajax web application to be concurrently safe\">\n"
+ " A: How to design a multi-user ajax web application to be concurrently safe\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " regard as an acceptable latency. This can be rather cruel to your infrastructure if you do not configure your (Apache?) and (<span class=\"result-highlight\">php</span>?) well enough to be "lightweight" starters. It is desirable to … , allowing apache to cache it, nevertheless refreshing it on the serverside when artifacts change. This takes <span class=\"result-highlight\">PHP</span>/memcache out of the game some for requests. Lighthttpd is verry efficent at serving static … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-javascript t-ajax t-web-applications t-multi-user\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2011-02-17 16:32:18Z\" class=\"relativetime\">Feb 17 '11</span> by <a href=\"/users/400049/christoph-strasen\">Christoph Strasen</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"answer-id-14560181\" data-position=\"14\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes answered\">\n"
+ " <span class=\"vote-count-post \"><strong>151</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/10003978/php-fpm-and-nginx-502-bad-gateway/14560181#14560181\" data-searchsession=\"/questions/10003978/php-fpm-and-nginx-502-bad-gateway/14560181?s=14|0.0000#14560181\" title=\"PHP-FPM and Nginx: 502 Bad Gateway\">\n"
+ " A: PHP-FPM and Nginx: 502 Bad Gateway\n"
+ " </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " If anyone finds this page by encountering the same problem I had, I found the answer here: http://www.howtoforge.com/installing-nginx-with-php5-and-<span class=\"result-highlight\">php</span>-fpm-and-mysql-support-lemp-on-ubuntu-12.04-lts … \n\n"
+ "For those of you who can't be bothered to click and work it out for themselves... ;)\n\n"
+ "The Condition:\n\n"
+ "Ubuntu or Debian server with NGINX and <span class=\"result-highlight\">PHP</span> 5.3 works fine but upgrading <span class=\"result-highlight\">PHP</span> to 5.4 gives 502 Bad … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-nginx t-amazon-ec2 t-php\">\n"
+ " </div>\n"
+ " <div class=\"started fr\">\n"
+ "answered <span title=\"2013-01-28 10:40:06Z\" class=\"relativetime\">Jan 28 '13</span> by <a href=\"/users/1081756/nealio82\">nealio82</a> </div>\n"
+ " </div>\n"
+ " </div>\n\n"
+ " <div class=\"question-summary search-result\" id=\"question-summary-8677493\" data-position=\"15\">\n"
+ " <div class=\"statscontainer\">\n"
+ " <div class=\"statsarrow\"></div>\n"
+ " <div class=\"stats\">\n"
+ " <div class=\"vote\">\n"
+ " <div class=\"votes \">\n"
+ " <span class=\"vote-count-post \"><strong>132</strong></span>\n"
+ " <div class=\"viewcount\">votes</div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"status answered\">\n"
+ " <strong>9</strong>answers\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <div class=\"summary\">\n"
+ " <div class=\"result-link\">\n"
+ " <span>\n\n"
+ " <a href=\"/questions/8677493/php-fpm-doesnt-write-to-error-log\" data-searchsession=\"/questions/8677493/php-fpm-doesnt-write-to-error-log?s=15|0.0000\" title=\"PHP-FPM doesn't write to error log\">\n"
+ "Q: PHP-FPM doesn't write to error log </a>\n"
+ "</span>\n"
+ " </div>\n"
+ " <div class=\"excerpt\">\n"
+ " /\n"
+ " {\n"
+ " root /var/www/sites/webusr/htdocs;\n"
+ " index index.html index.htm index.php;\n"
+ " }\n\n"
+ " # pass the <span class=\"result-highlight\">PHP</span> scripts to FastCGI server listening on <span class=\"result-highlight\">socket</span>\n"
+ " #\n"
+ " location ~ \\.<span class=\"result-highlight\">php</span> … I've just installed a nginx+<span class=\"result-highlight\">php</span>-fpm server. Everything seems fine except that <span class=\"result-highlight\">PHP</span>-FPM never writes error to its log.\n\n"
+ "fpm.conf\n\n"
+ "[default]\n"
+ "listen = /var/run/<span class=\"result-highlight\">php</span>-fpm/default.sock\n"
+ "listen.allowed_clients … \n"
+ " </div>\n"
+ " <div class=\"tags user-tags t-php\">\n"
+ "<a href=\"/questions/tagged/php\" class=\"post-tag\" title=\"show questions tagged 'php'\" rel=\"tag\">php</a> </div>\n"
+ " <div class=\"started fr\">\n"
+ "asked <span title=\"2011-12-30 08:14:39Z\" class=\"relativetime\">Dec 30 '11</span> by <a href=\"/users/1122600/eidng8\">eidng8</a> </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " </div>\n"
+ " <br class=\"cbt\">\n"
+ "<div class=\"pager fl\">\n"
+ " \n\n\n\n\n"
+ " <span class=\"page-numbers current\">1</span> <a href=\"/search?page=2&tab=Votes&q=php%20socket\" title=\"go to page 2\"> <span class=\"page-numbers\">2</span> </a> \n"
+ " <a href=\"/search?page=3&tab=Votes&q=php%20socket\" title=\"go to page 3\"> <span class=\"page-numbers\">3</span> </a> \n"
+ " <a href=\"/search?page=4&tab=Votes&q=php%20socket\" title=\"go to page 4\"> <span class=\"page-numbers\">4</span> </a> \n"
+ " <a href=\"/search?page=5&tab=Votes&q=php%20socket\" title=\"go to page 5\"> <span class=\"page-numbers\">5</span> </a> \n"
+ " <span class=\"page-numbers dots\">…</span> <a href=\"/search?page=579&tab=Votes&q=php%20socket\" title=\"go to page 579\"> <span class=\"page-numbers\">579</span> </a> \n"
+ " <a href=\"/search?page=2&tab=Votes&q=php%20socket\" rel=\"next\" title=\"go to page 2\"> <span class=\"page-numbers next\"> next</span> </a> \n\n"
+ " </div><div class=\"page-sizer fr\">\n"
+ " <a href=\"/search?tab=Votes&pagesize=15&q=php%20socket\" title=\"show 15 items per page\" class=\"page-numbers current\">15</a>\n"
+ " <a href=\"/search?tab=Votes&pagesize=30&q=php%20socket\" title=\"show 30 items per page\" class=\"page-numbers \">30</a>\n"
+ " <a href=\"/search?tab=Votes&pagesize=50&q=php%20socket\" title=\"show 50 items per page\" class=\"page-numbers \">50</a>\n"
+ " <span class=\"page-numbers desc\">per page</span>\n"
+ " </div></div>\n"
+ "<div id=\"sidebar\">\n\n"
+ "<div class=\"aside-cta\" role=\"navigation\" aria-label=\"ask new question\">\n"
+ " <a href=\"/questions/ask\" class=\"btn\" >Ask Question</a>\n"
+ "</div>\n";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}