Skip to content

Instantly share code, notes, and snippets.

@krusynth
Created May 29, 2014 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krusynth/d9e48447cd2fff58de83 to your computer and use it in GitHub Desktop.
Save krusynth/d9e48447cd2fff58de83 to your computer and use it in GitHub Desktop.
State Decoded parser for San Francisco's Charter for American Legal data
<?php
/**
* San Francisco parser for State Decoded.
* Extends AmericanLegal base classes.
*
* PHP version 5
*
* @license http://www.gnu.org/licenses/gpl.html GPL 3
* @version 0.8
* @link http://www.statedecoded.com/
* @since 0.3
*/
/**
* This class may be populated with custom functions.
*/
require 'class.AmericanLegal.inc.php';
class State extends AmericanLegalState {}
class Parser extends AmericanLegalParser
{
/*
* Regexes.
*/
// | type of section |!temp!| | section number (opt ' - section number') | | hyphen | catch line
public $section_regex = '/^\[?((?P<type>SEC(TION|S\.|\.)|APPENDIX|ARTICLE)\s+)?(?P<number>[0-9A-Z]+[0-9A-Za-z_\.\-]*(.?\s-\s[0-9]+[0-9A-Za-z\.\-]*)?)\.?\s*(?:-\s*)?(?P<catch_line>.*?)\.?\]?$/i';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment