rsssf 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/{HISTORY.md → CHANGELOG.md} +4 -0
  3. data/Manifest.txt +41 -7
  4. data/README.md +93 -71
  5. data/Rakefile +8 -7
  6. data/config/groups_en.txt +44 -0
  7. data/config/rounds_en.txt +283 -0
  8. data/config/rounds_es.txt +20 -0
  9. data/config/rounds_misc.txt +7 -0
  10. data/lib/_cocos_.rb +158 -0
  11. data/lib/rsssf/convert/convert.rb +71 -0
  12. data/lib/rsssf/convert/errata.rb +103 -0
  13. data/lib/rsssf/convert/html_entities.rb +150 -0
  14. data/lib/rsssf/convert/html_to_txt/beautify_anchors.rb +96 -0
  15. data/lib/rsssf/convert/html_to_txt/make_heading.rb +70 -0
  16. data/lib/rsssf/convert/html_to_txt/remove_emails.rb +43 -0
  17. data/lib/rsssf/convert/html_to_txt/replace_a_href.rb +85 -0
  18. data/lib/rsssf/convert/html_to_txt/replace_a_name.rb +87 -0
  19. data/lib/rsssf/convert/html_to_txt/replace_heading.rb +76 -0
  20. data/lib/rsssf/convert/html_to_txt/replace_hr.rb +25 -0
  21. data/lib/rsssf/convert/html_to_txt.rb +247 -0
  22. data/lib/rsssf/download.rb +20 -0
  23. data/lib/rsssf/fmtfix/dates.rb +541 -0
  24. data/lib/rsssf/fmtfix/dates_helpers.rb +63 -0
  25. data/lib/rsssf/fmtfix/errata.rb +44 -0
  26. data/lib/rsssf/fmtfix/fmtfix-base.rb +68 -0
  27. data/lib/rsssf/fmtfix/fmtfix.rb +101 -0
  28. data/lib/rsssf/fmtfix/goals.rb +173 -0
  29. data/lib/rsssf/fmtfix/headers.rb +326 -0
  30. data/lib/rsssf/fmtfix/outline.rb +228 -0
  31. data/lib/rsssf/fmtfix/patch_headings.rb +141 -0
  32. data/lib/rsssf/fmtfix/rounds.rb +74 -0
  33. data/lib/rsssf/fmtfix/score.rb +92 -0
  34. data/lib/rsssf/fmtfix/tables.rb +316 -0
  35. data/lib/rsssf/fmtfix/topscorers.rb +50 -0
  36. data/lib/rsssf/page-find_schedule.rb +127 -0
  37. data/lib/rsssf/page-meta.rb +68 -0
  38. data/lib/rsssf/page.rb +125 -238
  39. data/lib/rsssf/parse_schedules.rb +34 -0
  40. data/lib/rsssf/prepare/convert-links.rb +77 -0
  41. data/lib/rsssf/prepare/convert-meta.rb +111 -0
  42. data/lib/rsssf/prepare/convert-navlines.rb +154 -0
  43. data/lib/rsssf/prepare/convert-postproc.rb +141 -0
  44. data/lib/rsssf/prepare/convert.rb +100 -0
  45. data/lib/rsssf/prepare/download.rb +40 -0
  46. data/lib/rsssf/project.rb +154 -0
  47. data/lib/rsssf/reports/page.rb +66 -23
  48. data/lib/rsssf/reports/schedule.rb +89 -40
  49. data/lib/rsssf/schedule.rb +4 -14
  50. data/lib/rsssf/utils.rb +37 -45
  51. data/lib/rsssf/version.rb +7 -6
  52. data/lib/rsssf.rb +82 -19
  53. metadata +68 -26
  54. data/.gemtest +0 -0
  55. data/lib/rsssf/fetch.rb +0 -80
  56. data/lib/rsssf/html2txt.rb +0 -157
  57. data/lib/rsssf/patch.rb +0 -28
  58. data/lib/rsssf/repo.rb +0 -220
  59. data/test/helper.rb +0 -12
  60. data/test/test_utils.rb +0 -83
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9c33c4bef56bf6e79c9339b5010a3129b98dc9fa
4
- data.tar.gz: 4d97b1862dfbaab48282593947c6d7b28d047dfe
2
+ SHA256:
3
+ metadata.gz: 77eac4fd6af25c171a9367afb06db3461e923c25f567222638d96f0665ca242e
4
+ data.tar.gz: b996e7cb14c9fb945c7138d3bd92e6214f922bcb2baf5e35da41b8ea957ca6f6
5
5
  SHA512:
6
- metadata.gz: 8da437c2a72c364f81d53ca1491cdfca4c11c0f187912702e653523cb54f636ec910f8690f9af690cf632f0c98335b9ab10983676d0e67e1a59f3c7d7a5919c7
7
- data.tar.gz: b8a13466f301863e6ae0e4e449f1da08d5ae17a7481bf2055e12976f6f14fda79a8ebd38aa5cfb5f097d21b36e43bc322f362483d1c522a005c9cf49e576f732
6
+ metadata.gz: ccc33fe06442b36b88724328ee1d5de5259bd4a8283b640b9e2372caea8895447a3074d14e0aaf49f752e47054dab5466b594f69e796d05b48b4b855ee2d2afe
7
+ data.tar.gz: 41c5fa46b0d0562ca026dfe8d9fb2448957db2a86fadfee856f6ff853b930fe8e8b8659438f32619d880836d0ee32533a4e1a07d35fcaea3edd41f2e93173157
@@ -1,3 +1,7 @@
1
+ ### 0.3.0
2
+
3
+ ### 0.2.0
4
+
1
5
  ### 0.0.1 / 2015-09-15
2
6
 
3
7
  * Everything is new. First release
data/Manifest.txt CHANGED
@@ -1,17 +1,51 @@
1
- HISTORY.md
1
+ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ config/groups_en.txt
6
+ config/rounds_en.txt
7
+ config/rounds_es.txt
8
+ config/rounds_misc.txt
9
+ lib/_cocos_.rb
5
10
  lib/rsssf.rb
6
- lib/rsssf/fetch.rb
7
- lib/rsssf/html2txt.rb
11
+ lib/rsssf/convert/convert.rb
12
+ lib/rsssf/convert/errata.rb
13
+ lib/rsssf/convert/html_entities.rb
14
+ lib/rsssf/convert/html_to_txt.rb
15
+ lib/rsssf/convert/html_to_txt/beautify_anchors.rb
16
+ lib/rsssf/convert/html_to_txt/make_heading.rb
17
+ lib/rsssf/convert/html_to_txt/remove_emails.rb
18
+ lib/rsssf/convert/html_to_txt/replace_a_href.rb
19
+ lib/rsssf/convert/html_to_txt/replace_a_name.rb
20
+ lib/rsssf/convert/html_to_txt/replace_heading.rb
21
+ lib/rsssf/convert/html_to_txt/replace_hr.rb
22
+ lib/rsssf/download.rb
23
+ lib/rsssf/fmtfix/dates.rb
24
+ lib/rsssf/fmtfix/dates_helpers.rb
25
+ lib/rsssf/fmtfix/errata.rb
26
+ lib/rsssf/fmtfix/fmtfix-base.rb
27
+ lib/rsssf/fmtfix/fmtfix.rb
28
+ lib/rsssf/fmtfix/goals.rb
29
+ lib/rsssf/fmtfix/headers.rb
30
+ lib/rsssf/fmtfix/outline.rb
31
+ lib/rsssf/fmtfix/patch_headings.rb
32
+ lib/rsssf/fmtfix/rounds.rb
33
+ lib/rsssf/fmtfix/score.rb
34
+ lib/rsssf/fmtfix/tables.rb
35
+ lib/rsssf/fmtfix/topscorers.rb
36
+ lib/rsssf/page-find_schedule.rb
37
+ lib/rsssf/page-meta.rb
8
38
  lib/rsssf/page.rb
9
- lib/rsssf/patch.rb
10
- lib/rsssf/repo.rb
39
+ lib/rsssf/parse_schedules.rb
40
+ lib/rsssf/prepare/convert-links.rb
41
+ lib/rsssf/prepare/convert-meta.rb
42
+ lib/rsssf/prepare/convert-navlines.rb
43
+ lib/rsssf/prepare/convert-postproc.rb
44
+ lib/rsssf/prepare/convert.rb
45
+ lib/rsssf/prepare/download.rb
46
+ lib/rsssf/project.rb
11
47
  lib/rsssf/reports/page.rb
12
48
  lib/rsssf/reports/schedule.rb
13
49
  lib/rsssf/schedule.rb
14
50
  lib/rsssf/utils.rb
15
51
  lib/rsssf/version.rb
16
- test/helper.rb
17
- test/test_utils.rb
data/README.md CHANGED
@@ -1,19 +1,18 @@
1
1
  # rsssf - tools 'n' scripts for RSSSF (Rec.Sport.Soccer Statistics Foundation) archive data
2
2
 
3
3
 
4
- * home :: [github.com/sportdb/rsssf](https://github.com/sportdb/rsssf)
5
- * bugs :: [github.com/sportdb/rsssf/issues](https://github.com/sportdb/rsssf/issues)
4
+ * home :: [github.com/rsssf/scripts](https://github.com/rsssf/scripts)
5
+ * bugs :: [github.com/rsssf/scripts/issues](https://github.com/rsssf/scripts/issues)
6
6
  * gem :: [rubygems.org/gems/rsssf](https://rubygems.org/gems/rsssf)
7
7
  * rdoc :: [rubydoc.info/gems/rsssf](http://rubydoc.info/gems/rsssf)
8
- * forum :: [opensport](http://groups.google.com/group/opensport)
9
8
 
10
9
 
11
- ## What's the Rec.Sport.Soccer Statistics Foundation (RSSSF)?
12
10
 
13
- The RSSSF collects and offers football (soccer) league tables, match results and more
14
- from all over the world online in plain text.
15
11
 
16
- Example:
12
+ ## What's the Rec.Sport.Soccer Statistics Foundation (RSSSF)?
13
+
14
+ The RSSSF collects and offers football (soccer) league tables, match results and more
15
+ from all over the world online in plain text. Example:
17
16
 
18
17
  ```
19
18
  Round 1
@@ -46,16 +45,44 @@ Coritiba 2-1 Atlético/MG
46
45
 
47
46
  ## Usage
48
47
 
49
- ### Working with Pages
50
48
 
51
- To fetch pages from the world wide web use:
49
+ ### Download (and Cache) Pages
50
+
51
+ To download (and cache) pages from the world wide web use:
52
52
 
53
53
  ``` ruby
54
- page = RsssfPage.from_url( 'http://www.rsssf.com/tablese/eng2015.html')
54
+ Rsssf.download_page( 'https://rsssf.org/tablese/eng2024.html',
55
+ encoding: 'Windows-1252' )
56
+
57
+ Rsssf.download_page( 'https://rsssf.org/tablesb/braz2024.html',
58
+ encoding: 'Windows-1252' )
55
59
  ```
56
60
 
57
- Note: The `RsssfPageFetcher` will convert the rsssf archive page
58
- from hypertext (HTML) to plain text e.g.
61
+ Note: Most pages on rsssf.org use the Windows-1252 (character) encoding.
62
+ To "auto-magically" convert to unicode (utf-8)
63
+ add the encoding option (default is `UTF-8`).
64
+
65
+ <!--
66
+ Or as a convenience shortcut download (pre-configured table) pages by country code (e.g `eng` - England, `es` - Spain (España), `de` - Germany (Deutschland), `br` - Brazil (Brasil) etc.)
67
+ and season (e.g. `2023/24` or `2024` etc.)
68
+
69
+ ``` ruby
70
+ Rsssf.download_table( 'eng', season: '2023/24' )
71
+
72
+ Rsssf.download_table( 'br', season: '2024' )
73
+ ```
74
+ -->
75
+
76
+
77
+ Note: The rsssf machinery uses a built-in (local) web cache. All downloads get "auto-magically" cached (in `./cache/rsssf.org`).
78
+
79
+
80
+
81
+ ### Working with Pages (from .HTML to .TXT)
82
+
83
+
84
+ Note: The `RsssfPage` machinery lets you convert rsssf archive pages
85
+ from hypertext (.html) to plain text (.txt) e.g.
59
86
 
60
87
  ```
61
88
  <hr>
@@ -88,7 +115,7 @@ will become
88
115
  ‹Conference›
89
116
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
90
117
 
91
- #### Premier League
118
+ ==== Premier League
92
119
 
93
120
 
94
121
  Final Table:
@@ -100,105 +127,100 @@ Final Table:
100
127
  ```
101
128
 
102
129
 
103
- ### Working with Repos
104
130
 
105
- To fetch pages from the world wide web for many seasons in batch setup and use a repo.
131
+ Tip - See <https://github.com/rsssf/tables>
132
+ for a public online copy / mirror of converted
133
+ tables in .txt (preserving the original "ad-hoc" formats).
134
+
135
+
136
+
137
+
138
+ To fetch pages from the world wide web for many seasons in batch use
139
+ a (tabular) datafile in the comma-separted values (.csv) format.
106
140
 
107
141
  Step 1: List all archive pages
108
142
 
109
- In the `tables/config.yml` list all archive pages to fetch. Example:
143
+ In `eng.csv` list all archive pages to fetch. Example:
144
+
110
145
 
111
- ``` yaml
112
- 2010-11: tablese/eng2011.html
113
- 2011-12: tablese/eng2012.html
114
- 2012-13: tablese/eng2013.html
115
- 2013-14: tablese/eng2014.html
116
- 2014-15: tablese/eng2015.html
146
+ ``` csv
147
+ season, page, encoding
148
+ 2020/21, tablese/eng2021.html, windows-1252
149
+ 2021/22, tablese/eng2022.html, windows-1252
150
+ 2022/23, tablese/eng2023.html, windows-1252
151
+ 2023/24, tablese/eng2024.html, windows-1252
152
+ 2024/25, tablese/eng2025.html, windows-1252
117
153
  ```
118
154
 
119
- Step 2: Fetch all archive pages
155
+ Step 2: Download all archive pages
120
156
 
121
157
  Use:
122
158
 
123
159
  ``` ruby
124
- repo = RsssfRepo.new( './eng-england', title: 'England (and Wales)' )
125
- repo.fetch_pages
126
- ```
160
+ pages = read_csv( './eng.csv')
127
161
 
128
- Bonus: To create a summary of all pages fetched (e.g. authors, last_updated, sections, etc.).
129
- Use:
162
+ Rsssf::Prep.download_pages( pages )
130
163
 
131
- ``` ruby
132
- repo.make_pages_report
133
- ```
164
+ ## convert from .html to .txt
134
165
 
135
- Example - `tables/README.md`:
166
+ Rsssf::Prep.convert_pages( pages, outdir: './tables' )
167
+ ```
136
168
 
137
169
 
138
- football.db RSSSF Archive Data Summary for England (and Wales)
139
170
 
140
- _Last Update: 2015-11-26 18:22:22 +0200_
141
171
 
142
- | Season | File | Authors | Last Updated | Lines (Chars) | Sections |
143
- | :------ | :------ | :------- | :----------- | ------------: | :------- |
144
- | 2014-15 | [eng2015.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2015.txt) | Ian King and Karel Stokkermans | 4 Jun 2015 | 1249 (34138) | Premier League, Cup Tournaments, Championship, Division 1, Division 2, Conference |
145
- | 2013-14 | [eng2014.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2014.txt) | Ian King and Karel Stokkermans | 5 Feb 2015 | 1254 (34294) | Premier League, Cup Tournaments, Championship, Division 1, Division 2, Conference |
146
- | 2012-13 | [eng2013.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2013.txt) | Karel Stokkermans | 5 Feb 2015 | 1269 (34531) | Premiership, Cup Tournaments, Championship, Division 1, Division 2, Conference |
147
- | 2011-12 | [eng2012.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2012.txt) | Karel Stokkermans | 5 Feb 2015 | 691 (21925) | Premiership, Cup Tournaments, Championship, Division 1, Division 2, Conference |
148
- | 2010-11 | [eng2011.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2011.txt) | Ian King, Karel Stokkermans and Jan Schoenmakers | 5 Feb 2015 | 959 (37393) | Premiership, Cup Tournaments, Championship, Division 1, Division 2, Conference |
172
+ For more and the latest news 'n' updates
173
+ incl. how to mirror the rsssf.org website (all 40000+ pages),
174
+ see the [`/scripts` source repo »](https://github.com/rsssf/scripts)
149
175
 
150
176
 
151
177
  That's it.
152
178
 
153
179
 
154
- ### Preparing Archive Pages for SQL Database Imports (e.g. football.db)
155
180
 
156
- To import match schedules (fixtures and results) and more using the football.db machinery
157
- prepare "simple" single league (or cup) pages with standings tables etc. stripped out.
158
- For example, to break-out the Premier League and FA Cup from the `eng2015.txt`
159
- archive page use:
160
181
 
161
- ``` ruby
162
- page = RsssfPage.from_url( 'http://www.rsssf.com/tablese/eng2015.html')
163
182
 
164
- schedule = page.find_schedule( header: 'Premier League') ## returns RsssfSchedule obj
165
- schedule.save( './1-premierleague.txt' )
183
+ ### Preparing Archive Pages for SQL Database Imports
166
184
 
167
- schedule = page.find_schedule( header: 'FA Cup', cup: true )
168
- schedule.save( './facup.txt' )
169
- ```
185
+ Note: The rsssf machinery includes helpers
186
+ that try the best to convert the "ad-hoc" rsssf formats into
187
+ the structured Football.TXT format but expect no miracles
188
+ and fix any remaining errors "by hand"
189
+ or with your own little search & replace scripts
190
+ or why not with
191
+ the help of the latest and greatest large language models (LLMs)?
170
192
 
171
193
 
194
+ To split-up the all-in-one page and break-out sections
195
+ such as the Premier League or FA Cup from the `eng2015.txt`, for example,
196
+ use:
172
197
 
173
- ## Install
198
+ ``` ruby
199
+ page = RsssfPage.read_txt( './pages/eng2015.txt')
174
200
 
175
- Just install the gem:
201
+ schedule = page.find_schedule( header: 'Premier League') ## returns RsssfSchedule obj
202
+ schedule.save( './2014-15/1-premierleague.txt' )
176
203
 
177
- $ gem install rsssf
204
+ schedule = page.find_schedule( header: 'FA Cup' )
205
+ schedule.save( './2014-15/facup.txt' )
206
+ ```
178
207
 
179
208
 
180
209
 
181
- ## RSSSF Datasets
182
210
 
183
- See the rsssf github org for pre-processed ready-to-import datasets. Prepared repos include:
211
+ Tip: See the rsssf github org for sample pages
212
+ with format autofixes applied including:
184
213
 
185
- - [`eng-england`](https://github.com/rsssf/eng-england) - rsssf archive data for England - Premier League, Championship, FA Cup etc.
186
- - [`de-deutschland`](https://github.com/rsssf/de-deutschland) - rsssf archive data for Germany (Deutschland) - Deutsche Bundesliga, 2. Bundesliga, 3. Liga, DFB Pokal etc.
187
- - [`es-espana`](https://github.com/rsssf/es-espana) - rsssf archive data for España (Spain) - Primera División / La Liga, Copa de Rey, etc.
188
- - [`at-austria`](https://github.com/rsssf/at-austria) - rsssf archive data for Austria (Österreich) - Österr. Bundesliga, Erste Liga, ÖFB Pokal etc.
189
- - [`br-brazil`](https://github.com/rsssf/br-brazil) - rsssf archive data for Brazil (Brasil) - Campeonato Brasileiro Série A / Brasileirão etc.
214
+ - [`/england`](https://github.com/rsssf/clubs/tree/master/england) - rsssf archive data for England - Premier League, Championship, FA Cup etc.
215
+ - [`/germany`](https://github.com/rsssf/clubs/tree/master/germany) - rsssf archive data for Germany (Deutschland) - Deutsche Bundesliga, 2. Bundesliga, 3. Liga, DFB Pokal etc.
216
+ - [`/spain`](https://github.com/rsssf/clubs/tree/master/spain) - rsssf archive data for España (Spain) - Primera División / La Liga, Copa de Rey, etc.
217
+ - [`/austria`](https://github.com/rsssf/clubs/tree/master/austria) - rsssf archive data for Austria (Österreich) - Österr. Bundesliga, Erste Liga, ÖFB Pokal etc.
218
+ - [`/brazil`](https://github.com/rsssf/clubs/tree/master/brazil) - rsssf archive data for Brazil (Brasil) - Campeonato Brasileiro Série A / Brasileirão etc.
190
219
  - and more
191
220
 
192
221
 
222
+
193
223
  ## License
194
224
 
195
225
  The `rsssf` scripts are dedicated to the public domain.
196
226
  Use it as you please with no restrictions whatsoever.
197
-
198
-
199
- ## Questions? Comments?
200
-
201
- Send them along to the
202
- [Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
203
- Thanks!
204
-
data/Rakefile CHANGED
@@ -8,25 +8,26 @@ Hoe.spec 'rsssf' do
8
8
  self.summary = "rsssf - tools 'n' scripts for RSSSF (Rec.Sport.Soccer Statistics Foundation) archive data"
9
9
  self.description = summary
10
10
 
11
- self.urls = ['https://github.com/sportdb/rsssf']
11
+ self.urls = { home: 'https://github.com/rsssf/scripts' }
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
- self.email = 'opensport@googlegroups.com'
14
+ self.email = 'gerald.bauer@gmail.com'
15
15
 
16
16
  # switch extension to .markdown for gihub formatting
17
17
  self.readme_file = 'README.md'
18
- self.history_file = 'HISTORY.md'
18
+ self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['logutils'],
22
- ['textutils'],
23
- ['fetcher'],
21
+ ['cocos'],
22
+ ['season-formats'],
23
+ ['webget'],
24
24
  ]
25
25
 
26
+
26
27
  self.licenses = ['Public Domain']
27
28
 
28
29
  self.spec_extras = {
29
- required_ruby_version: '>= 1.9.2'
30
+ required_ruby_version: '>= 2.2.2'
30
31
  }
31
32
 
32
33
  end
@@ -0,0 +1,44 @@
1
+ ##
2
+ # groups e.g.
3
+ # zones e.g.
4
+ # sections e.g.
5
+ # conferences e.g.
6
+ ##
7
+
8
+ ## fix - move to groups.txt !!!
9
+ ## groups
10
+
11
+ ## e.g group a, group b,
12
+ ## group 1, group 2,
13
+ ## group i, group ii, etc.
14
+ ##
15
+ ## add a1,b1, etc too - why? why not?
16
+
17
+
18
+ ## make build-in - why? why not?
19
+
20
+ Group [ ] ( [a-z] \
21
+ | \d{1,2} \
22
+ | i | ii | iii | iv \
23
+ )
24
+
25
+ ## for groups and legs
26
+ ## use ▪▪ (double) - why? why not?
27
+ or zones (like groups)
28
+
29
+
30
+ ###
31
+ ## mls/usa
32
+ Eastern·conference
33
+ Central·conference
34
+ Western·conference
35
+
36
+
37
+ ######
38
+ ## sco(tland)
39
+
40
+ North·section
41
+ South·section
42
+ Western·Isles·section
43
+ Shetland·Island·section
44
+ Orkney·Isles·section
@@ -0,0 +1,283 @@
1
+ ##
2
+ # rounds in english (en)
3
+ #
4
+ #
5
+ # note: limited support for regex syntax supported
6
+ # use ?
7
+ # use () for groups
8
+ # and use |
9
+
10
+ # note - leading and trailing spaces get removed
11
+ # and inline spaces squished (reduced to one)
12
+
13
+ ##
14
+ ## note - inline spaces get translated to [] e.g.
15
+ ### UNLESS (IF NOT) [] present in line!!!
16
+ ## 1/16 finals => 1/16 [ ] finals
17
+ ## 1/8 finals? => 1/8 [ ] finals?
18
+
19
+
20
+ ##
21
+ ## note - to processing modes
22
+ ## if regex metachars found - line is regex!!
23
+ ## if no regex metachars found - line is plain and get preprocesed
24
+
25
+
26
+ ##
27
+ ## check how to support here
28
+ ## Round [ ]{1,2} \d{1,2} ## e.g. round 1, round 2, etc.
29
+
30
+
31
+ ##
32
+ ## note - always remove leading & trailing spaces
33
+ ## and squish inline spaces
34
+ ##
35
+ ## note - group (...) gets changed to
36
+ ## non-capturing group (?: ...)
37
+ ##
38
+ ## use \ for line-continuation!!!
39
+ #
40
+ #
41
+ ## optional shortcut
42
+ ## replace Middle Dot (·) Unicode: U+00B7 or
43
+ ## Open Box (␣) Unicode: U+2423 or
44
+ ## with [ ]
45
+
46
+
47
+ $ordinal = ( First | Second | Third | Fourth | Fifth \
48
+ | 1st | 2nd | 3rd | 4th | 5th )
49
+
50
+ $opt_replay = ( [ ] replays? )?
51
+
52
+
53
+ ## e.g. Playoff, Playoffs, Play-off, Play-offs
54
+ $playoff = play-?offs?
55
+
56
+ ## e.g. Match, Matches
57
+ $match = match(es)?
58
+
59
+
60
+
61
+
62
+ Preliminary·round
63
+
64
+ ## e.g. First round, Second round, ...
65
+ $ordinal [ ] ( round $opt_replay \
66
+ | phase )
67
+
68
+
69
+ Round·one
70
+
71
+
72
+
73
+ ## e.g. 1/8 finals, 8th finals...
74
+ ( 1/32 \
75
+ | 1/16 | 16th \
76
+ | 1/8 | 8th \
77
+ | 1/4 \
78
+ | 1/2 ) [ ] finals? $opt_replay
79
+
80
+
81
+ ## e.g. Eight-finals, Eight finals, Eightfinals, ...
82
+ ( Eight \
83
+ | Quarter \
84
+ | Semi ) [ -]? finals? $opt_replay
85
+
86
+ ## short-forms
87
+ Semis
88
+ Quarters
89
+
90
+
91
+ ## e.g. Round of 16, Last 16, ...
92
+ (Round·of | Last ) [ ] ( 4 | 8 | 16 | 32)
93
+
94
+
95
+
96
+
97
+ ## e.g. fifth place, fifth-place, 5th place
98
+ $fifthplace = ( fifth | 5th ) [ -] place
99
+
100
+ $fifthplace [ ] ( match | final | play[ -]?off )
101
+ Match·for [ ] $fifthplace
102
+
103
+
104
+ ## e.g. third place, third-place, 3rd place
105
+ $thirdplace = ( third | 3rd ) [ -] place
106
+
107
+ $thirdplace [ ] ( match | final | play[ -]?off )
108
+ Match·for [ ] $thirdplace
109
+
110
+
111
+ Finals? $opt_replay
112
+
113
+
114
+ ###
115
+ # more
116
+
117
+ Final [ ] (round | group | pool)
118
+
119
+
120
+
121
+
122
+
123
+ ## e.g. Minor Semifinals
124
+ (Minor | Major) [ ] Semi [ -]? finals?
125
+
126
+ Preliminary·final
127
+ Final·series
128
+ Grand·final
129
+
130
+
131
+
132
+
133
+ Conference·wild·card·round
134
+ Wild·card·games
135
+
136
+ (Eastern | Western) [ ] conference [ ] quarter [ -]? finals
137
+ (Eastern | Western) [ ] semi [ -]? finals
138
+ (Eastern | Western) [ ] conference·final
139
+
140
+ Conference·quarterfinals
141
+ Conference·semifinals
142
+ Conference·finals
143
+
144
+ Divisional·finals
145
+ Championship·final
146
+
147
+ ## used in msl/usa for "grand final"
148
+ ## e.g. MLS cup, MLS cup final, MLS cup 2010, ...
149
+ MLS·cup ([ ] final)? ([ ] \d{4})?
150
+
151
+ ### move to stage?
152
+ ## use/replace w/ generic Qualifaction <name> - why? why not?
153
+ Qualification·MLS
154
+
155
+
156
+ Super [ ] semi [ -]? final
157
+
158
+ Super [ ]? cup [ ] final
159
+
160
+
161
+ Deciding·match
162
+ Decider
163
+
164
+
165
+
166
+ ## in jp
167
+ $playoff [ ] round
168
+ Prime [ ] round
169
+
170
+
171
+ ## in it (cup)
172
+ ## with (no extra time) flag/note
173
+ ## e.g. Round 1 (no extra time)
174
+
175
+ Round [ ] (1|2|3) [ ] \( no [ ] extra [ ] time \)
176
+ Quarter [ -]? finals? [ ] \( no [ ] extra [ ] time \)
177
+
178
+
179
+
180
+
181
+
182
+ ###
183
+ # moved matches - find a better name?
184
+ # nachtragspiele (de) in en ??
185
+
186
+ ## e.g. Moved matches,
187
+ ## Moved match, ..
188
+ Moved·$match
189
+
190
+ ## e.g. Match from round 26,
191
+ ## Matches from round 26
192
+ $match·from [ ] round [ ] \d{1,2}
193
+
194
+
195
+ ## standalone replay
196
+ Replays?
197
+
198
+ ## e.g. Replayed match,
199
+ ## Replayed matches
200
+ Replayed·$match
201
+
202
+
203
+
204
+
205
+
206
+ #############
207
+ ## add stages
208
+
209
+ ## e.g. First stage, Second stage, ...
210
+ $ordinal [ ] stage
211
+
212
+ ( Regular \
213
+ | Group \
214
+ | League \
215
+ | Playoff ) [ ] stage
216
+
217
+ Knock-?out·stage
218
+
219
+ Regular·season
220
+
221
+ Tournament·proper
222
+
223
+
224
+
225
+ #####
226
+ ## play-offs & play-ins
227
+
228
+ Championship [ ] $playoff
229
+ Europa·league [ ] $playoff
230
+ Conference·league [ ] $playoff
231
+
232
+ Promotion [ ] ($playoff | $match)
233
+ Relegation [ ] ($playoff | $match)
234
+ Promotion/relegation [ ] ($playoff | $match)
235
+ Promotion/relegation [ ] ($playoff | $match) [ ] \
236
+ ( 1st/2nd \
237
+ | 2nd/3rd \
238
+ | 3rd/4th) [ ] level
239
+
240
+
241
+ Relegation·playout
242
+ Play-?out
243
+
244
+
245
+ ## e.g. Play-in round A, Play-in round B, Play-in round A-B
246
+ ## note - escape for literal () required!!
247
+
248
+ Play-in·round [ ] ( A | B | A-B )
249
+
250
+
251
+ ## standalone playoff
252
+ ## e.g Playoff, Playoff 1, Playoff 2
253
+
254
+ $playoff
255
+ $playoff [ ] (1 | 2)?
256
+
257
+
258
+
259
+
260
+ #############
261
+ ## standalone legs
262
+
263
+ ## e.g. First legs
264
+ ## Second leg replay
265
+ $ordinal [ ] legs? $opt_replay
266
+
267
+
268
+ Third·leg·minigame # in us
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+