Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

patterns.js 2.3 KB

You have to be logged in to leave a comment. Sign In
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
  1. // This module is intended to keep our use of regular expressions DRY,
  2. // and to reduce the overhead of instantiating new RegExp objects
  3. // if we're looking for part of a path, like /github,
  4. // we allow for four characters after the string: (\/|$|\?|#)
  5. // slash (/), end of line ($), query param (?), fragment (#)
  6. // this will ensure we capture: /github/foo, /github, /github?query=foo, /github#foo
  7. // and not capture: /github-foo
  8. module.exports = {
  9. githubDotcom: /\/github(\/|$|\?|#)/,
  10. // we want to capture `/enterprise` and `/enterprise/foo` but NOT `/enterprise-admin`
  11. enterprise: /\/enterprise(?:\/|$|\?)(\d+\.\d+)?/,
  12. admin: /enterprise\/(\d+\.\d+\/)?admin\/?/,
  13. gheUser: /enterprise\/(\d+\.\d+\/)?user(\/|$|\?)/,
  14. enterpriseHomepage: /\/enterprise\/?(\d+\.\d+)?$/,
  15. desktop: /desktop\//,
  16. oldGuidesPath: /(\/admin|(^|\/)desktop)\/guides/,
  17. // need to capture 11.10.340 and 2.0+
  18. getEnterpriseVersionNumber: /^.*?enterprise\/(\d+\.\d+(?:\.340)?).*?$/,
  19. removeEnterpriseVersion: /(enterprise\/)\d+\.\d+\//,
  20. guides: /guides\//,
  21. hasLanguageCode: /^\/[a-z]{2}(\/|$|\?)/,
  22. getLanguageCode: /^\/([a-z]{2})/,
  23. trailingSlash: /^(.+?)\/+?$/,
  24. searchPath: /\/search(?:\/)?(\?)/,
  25. ymd: /^\d{4}-\d{2}-\d{2}$/,
  26. hasLiquid: /[{{][{%]/,
  27. dataReference: /{% ?data\s(?:early-access\.)?(?:reusables|variables|ui)\..*?%}/gm,
  28. imagePath: /\/?assets\/images\/.*?\.(png|svg|gif|pdf|ico|jpg|jpeg)/gi,
  29. homepagePath: /^\/\w{2}$/, // /en, /ja, /cn
  30. multipleSlashes: /^\/{2,}/,
  31. assetPaths: /\/(?:javascripts|stylesheets|assets|node_modules|dist)\//,
  32. oldApiPath: /\/v[34]\/(?!guides|overview).+?\/.+/,
  33. staticRedirect: /<link rel="canonical" href="(.+?)">/,
  34. enterpriseNoVersion: /\/enterprise\/([^\d].*$)/,
  35. // a {{ currentVersion }} in internal links may inject '<new-version@release>' into old paths,
  36. // so the oldEnterprisePath regex must match: /enterprise/private-instances@latest/user,
  37. // /enterprise/enterprise-server@2.22/user, /enterprise/2.22/user, and /enterprise/user
  38. oldEnterprisePath: /\/([a-z]{2}\/)?(enterprise\/)?(\S+?@(\S+?\/))?(\d.\d+\/)?(user[/$])?/,
  39. // new versioning format patterns
  40. adminProduct: /\/admin(\/|$|\?|#)/,
  41. insightsProduct: /\/insights(\/|$|\?|#)/,
  42. enterpriseServer: /\/enterprise-server@/,
  43. getEnterpriseServerNumber: /enterprise-server@(\d+\.\d+)/
  44. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...