User:Pathoschild/Regex

From Wikisource
Jump to navigation Jump to search
Pathoschilduserspace map ] (Regex patterns)
This is a repository of observed patterns useful to Pathosbot or other automated scripts.


Authors[edit]

Dates[edit]

Description Determine whether an author is living or dead, and extract the birth and death dates.
Notes These patterns are based on observations only, and have not been tested.
Possible tasks
  • Compare death dates with license tags to find outdated tags.
  • List formerly living authors that may be dead now.
  • Categorise authors by date or era.
Required bot capabilities
  • Singleline mode (all text treated as one line)
  • If (perform a given pattern only if a condition is met)
  • Greedy mode (match as much as regex permits)
Logic and patterns
  • base regex:
    {{author[^}]+dates[^=]*=[^\|}]*
    + regex +
    [^\|]+\|[^}]+}}
    • Dead ($1 century):
      ([0-9]+)[^\|]*century
    • Else dead, $1 to $2:
      ([0-9\?\-]{3,4})[^\|]*([0-9\?\-]{3,4})
    • Else living, $1:
      b.\s*([0-9\?\-]{4})
    • Else dead, $1 to $2 (fuzzy regex may match month/days):
      ([0-9\?\-]{1,2})[^\|]*([0-9\?\-]{1,2})
    • Else probably living ($1):
      ([0-9]{4})
    • Else unknown or unspecified.