Last active
August 29, 2015 14:03
-
-
Save ivamluz/c17ba6151807edc8bb5a to your computer and use it in GitHub Desktop.
Regex (and PHP code sample) for parsing Drupal .info files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (preg_match('/^([a-zA-Z\[\]]+)\s*=\s*(.+)$/', $line, $matches)) { | |
// $matches[0]: whole line matched | |
// $matches[1]: property name | |
// $matches[2]: property value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment