Advertisement
jargon

How do I pattern match using an array of simultaneous candidates?

Jan 16th, 2022
1,258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1.     $flags = array(
  2.         0 => 'broken',
  3.         1 => 'broke',
  4.         2 => 'fixed',
  5.         3 => 'fix',
  6.         4 => 'update',
  7.         5 => 'glitched',
  8.         6 => 'glitch',
  9.         7 => 'wip',
  10.         8 => 'ok',
  11.         9 => '100 percent',
  12.         10 => '1 to 1'
  13.     );
  14.    
  15.     $pattern =
  16. '/(?<project>.*)(?<ts>(?<yyyy>[0-9]{4})\-(?<mmdd>[0-9]{4})\-(?<hhnn>[0-9]{4}))(\-)(?<comment>(.*\s|)(?<flag>'.implode('|',$flags).')(\s.*|))(?<ext>\.(7z|zip))/';
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement