{"id":16749650,"url":"https://github.com/chriskonnertz/regex","last_synced_at":"2025-03-16T03:43:12.858Z","repository":{"id":56952399,"uuid":"116583949","full_name":"chriskonnertz/RegEx","owner":"chriskonnertz","description":"Use methods to fluently create a regular expression in PHP","archived":false,"fork":false,"pushed_at":"2019-04-26T16:49:33.000Z","size":150,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T16:26:34.427Z","etag":null,"topics":["api","expression","fluent","interface","library","oop","php","regex","regex-string","regular","regular-expression"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chriskonnertz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-07T17:12:32.000Z","updated_at":"2019-04-26T16:49:35.000Z","dependencies_parsed_at":"2022-08-21T03:40:21.466Z","dependency_job_id":null,"html_url":"https://github.com/chriskonnertz/RegEx","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2FRegEx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2FRegEx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2FRegEx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriskonnertz%2FRegEx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chriskonnertz","download_url":"https://codeload.github.com/chriskonnertz/RegEx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822277,"owners_count":20353499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","expression","fluent","interface","library","oop","php","regex","regex-string","regular","regular-expression"],"created_at":"2024-10-13T02:25:30.546Z","updated_at":"2025-03-16T03:43:12.829Z","avatar_url":"https://github.com/chriskonnertz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RegEx\n\n[![Build Status](https://img.shields.io/travis/chriskonnertz/RegEx.svg?style=flat-square)](https://travis-ci.org/chriskonnertz/RegEx)\n[![Version](https://img.shields.io/packagist/v/chriskonnertz/RegEx.svg?style=flat-square)](https://packagist.org/packages/chriskonnertz/regex)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/chriskonnertz/RegEx/master/LICENSE)\n\nUse methods to fluently create a regular expression in PHP. \nThis is more intuitive and understandable than writing plain regular expressions.\n\n## Installation\n\nThrough [Composer](https://getcomposer.org/):\n\n```\ncomposer require chriskonnertz/regex\n```\n\nFrom then on you may run `composer update` to get the latest version of this library.\n\nIt is possible to use this library without using Composer but then it is necessary to register an \n[autoloader function](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md#example-implementation).\n\n\u003e This library requires PHP 7.0 or higher.\n\n## Usage example\n\nHere is an example. It assumes that there is an autoloader.\n\n```php\n$regEx = new ChrisKonnertz\\RegEx\\RegEx();\n\n$regEx-\u003eaddAnd('http')\n      -\u003eaddOption('s')\n      -\u003eaddAnd('://')\n      -\u003eaddOption('www.')\n      -\u003eaddWordChars()\n      -\u003eaddAnd('.')\n      -\u003eaddWordChars();\n      \necho $regEx;\n```\n\nThis will print out `/(?:http)(?:s)?(?:\\:\\/\\/)(?:www\\.)?(?:\\w+)(?:\\.)(?:\\w+)/` and  \nmatch for example `https://www.example.org`. \nThere is not much beauty in this regular expression. However, it is valid.\n\nNote that special characters will be quoted: `123-456` will become `123\\-456`. \nYou may call the `addRaw()` method to avoid this behaviour.\n\n## More examples\n\nHere is an example how to create a nested regular expression:\n\n```\n$regEx = new ChrisKonnertz\\RegEx\\RegEx();\n\n$regEx-\u003eaddRaw(new RangeEx('a-zA-Z'), '+');\n\necho $regEx;\n```\n\nThis will print out `[a-zA-Z]+` (with some extras).\n\nRe-using the `RegEx` object works this way:\n\n```\n$regEx = new ChrisKonnertz\\RegEx\\RegEx();\n\n$regEx-\u003eaddAnd('First test);\necho $regEx;\n\n$rexEx-\u003eclear()-\u003eaddAnd('Second test');\necho $regEx;\n```\n\nThe `clear()` method will reset the `RegEx` object so you can reuse it to build a new regular expression.\n\n## Builder methods\n\n\u003e The example results might differ from the actual output. \nSome of them are simplified to make it easier to understand them.\n\n### addAnyChar\n\n```php\n$regEx-\u003eaddAnyChar();\n```\n\nAdds a partial expression that expects any single character (except by default \"new line\").\n\nExample of the resulting regex string: `.`\n\nExamples of matching strings: `a`, `1`\n\n### addAnyChars\n\n```php\n$regEx-\u003eaddAnyChars();\n```\n\nAdds a partial expression that expects 1..n of any characters (except by default \"new line\").\n\nExample of the resulting regex string: `.+`\n\nExamples of matching strings: `a`, `a1`\n\n### addMaybeAnyChars\n\n```php\n$regEx-\u003eaddMaybeAnyChars();\n```\n\nAdds a partial expression that expects 0..n of any characters (except by default \"new line\").\n\nExample of the resulting regex string: `.*`\n\nExamples of matching strings: `a`, `a1`, empty string\n\n### addDigit\n\n```php\n$regEx-\u003eaddDigit();\n```\n\nAdds a partial expression that expects a single digit.\nSame as: `[0-9]`\n\nExample of the resulting regex string: `\\d`\n\nExamples of matching strings: `1`, `0`\n\n### addDigits\n\n```php\n$regEx-\u003eaddDigits();\n```\n\nAdds a partial expression that expects 1..n of digits.\nSame as: `[0-9]+`\n\nExample of the resulting regex string: `\\d+`\n\nExamples of matching strings: `1`, `12`\n\n### addMaybeDigits\n\n```php\n$regEx-\u003eaddMaybeDigits();\n```\n\nAdds a partial expression that expects 0..n of digits.\nSame as: `[0-9]*`\n\nExample of the resulting regex string: `\\d*`\n\nExamples of matching strings: `1`, `12`, empty string\n\n### addNonDigit\n\n```php\n$regEx-\u003eaddNonDigit();\n```\n\nAdds a partial expression that expects a character that is not a digit.\nSame as: `[^0-9]`\n\nExample of the resulting regex string: `\\D`\n\nExamples of matching strings: `a`, `-`\n\n### addNonDigits\n\n```php\n$regEx-\u003eaddNonDigits();\n```\n\nAdds a partial expression that expects 1..n of characters that are not digits.\nSame as: `[^0-9]+`\n\nExample of the resulting regex string: `\\D+`\n\nExamples of matching strings: `a`, `ab`\n\n### addMaybeNonDigits\n\n```php\n$regEx-\u003eaddMaybeNonDigits();\n```\n\nAdds a partial expression that expects 0..n of characters that are not digits.\nSame as: `[^0-9]*`\n\nExample of the resulting regex string: `\\D*`\n\nExamples of matching strings: `a`, `ab`, empty string\n\n### addLetter\n\n```php\n$regEx-\u003eaddLetter();\n```\n\nAdds a partial expression that expects a single letter.\n\nExample of the resulting regex string: `[a-zA-Z]`\n\nExamples of matching strings: `a`, `Z`\n\n### addLetters\n\n```php\n$regEx-\u003eaddLetters();\n```\n\nAdds a partial expression that expects 1..n of letters.\n\nExample of the resulting regex string: `[a-zA-Z]+`\n\nExamples of matching strings: `a`, `aB`\n\n### addMaybeLetters\n\n```php\n$regEx-\u003eaddMaybeLetters();\n```\n\nAdds a partial expression that expects 0..n of letters.\n\nExample of the resulting regex string: `[a-zA-Z]*`\n\nExamples of matching strings: `a`, `aB`, empty string\n\n### addWordChar\n\n```php\n$regEx-\u003eaddWordChar();\n```\n\nAdds a partial expression that expects a single word character.\nThis includes letters, digits and the underscore.\nSame as: `[a-zA-Z_0-9]`\n\nExample of the resulting regex string: `\\w`\n\nExamples of matching strings: `a`, `B`, `1`\n\n### addWordChars\n\n```php\n$regEx-\u003eaddWordChars();\n```\n\nAdds a partial expression that expects 1..n of word characters.\nThis includes letters, digits and the underscore.\nSame as: `[a-zA-Z_0-9]+`\n\nExample of the resulting regex string: `\\w+`\n\nExamples of matching strings: `a`, `ab`\n\n### addMaybeWordChars\n\n```php\n$regEx-\u003eaddMaybeWordChars();\n```\n\nAdds a partial expression that expects 0..n of word characters.\nThis includes letters, digits and the underscore.\nSame as: `[a-zA-Z_0-9]*`\n\nExample of the resulting regex string: `\\w*`\n\nExamples of matching strings: `a`, `ab`, empty string\n\n### addNonWordChar\n\n```php\n$regEx-\u003eaddNonWordChar();\n```\n\nAdds a partial expression that expects a character that is not a word character.\nThis includes letters, digits and the underscore.\nSame as: `[^a-zA-Z_0-9]`\n\nExample of the resulting regex string: `\\W`\n\nExample of matching string: `-`\n\n### addNonWordChars\n\n```php\n$regEx-\u003eaddNonWordChars();\n```\n\nAdds a partial expression that expects 1..n of characters that are not word characters.\nThis includes letters, digits and the underscore.\nSame as: `[^a-zA-Z_0-9]+`\n\nExample of the resulting regex string: `\\W+`\n\nExamples of matching strings: `-`, `-=`\n\n### addMaybeNonWordChars\n\n```php\n$regEx-\u003eaddMaybeNonWordChars();\n```\n\nAdds a partial expression that expects 0..n of characters that are not word characters.\nThis includes letters, digits and the underscore.\nSame as: `[^a-zA-Z_0-9]*`\n\nExample of the resulting regex string: `\\W*`\n\nExamples of matching strings: `-`, `-=`, empty string\n\n### addWhiteSpaceChar\n\n```php\n$regEx-\u003eaddWhiteSpaceChar();\n```\n\nAdds a partial expression that expects a white space character.\nThis includes: space, \\f, \\n, \\r, \\t and \\v\n\nExample of the resulting regex string: `\\s`\n\nExample of matching string: ` ` (one space)\n\n### addWhiteSpaceChars\n\n```php\n$regEx-\u003eaddWhiteSpaceChars();\n```\n\nAdds a partial expression that expects 1..n of white space characters.\nThis includes: space, \\f, \\n, \\r, \\t and \\v\n\nExample of the resulting regex string: `\\s+`\n\nExamples of matching strings: ` ` (one space), `  ` (two spaces)\n\n### addMaybeWhiteSpaceChars\n\n```php\n$regEx-\u003eaddMaybeWhiteSpaceChars();\n```\n\nAdds a partial expression that expects 0..n of white space characters.\nThis includes: space, \\f, \\n, \\r, \\t and \\v\n\nExample of the resulting regex string: `\\s*`\n\nExamples of matching strings: ` ` (one space), `  ` (two spaces), empty string\n\n### addTabChar\n\n```php\n$regEx-\u003eaddTabChar();\n```\n\nAdds a partial expression that expects a single tabulator (tab).\n\nExample of the resulting regex string: `\\t`\n\nExamples of matching strings: `\\t`\n\n### addTabChars\n\n```php\n$regEx-\u003eaddTabChars();\n```\n\nAdds a partial expression that expects 1..n tabulators (tabs).\n\nExample of the resulting regex string: `\\t+`\n\nExamples of matching strings: `\\t`, `\\t\\t`\n\n### addMaybeTabChars\n\n```php\n$regEx-\u003eaddMaybeTabChars();\n```\n\nAdds a partial expression that expects 0..n tabulators (tabs).\n\nExample of the resulting regex string: `\\t*`\n\nExamples of matching strings: `\\t`, `\\t\\t`, empty string\n\n### addLineBreak\n\n```php\n$regEx-\u003eaddLineBreak();\n$regEx-\u003eaddLineBreak(PHP_EOL);\n```\n\nAdds a partial expression that expects a line break.\nPer default `\\n` and `\\r\\n` will be recognized.\nYou may pass a parameter to define a specific line break pattern.\n\nExample of the resulting regex string: `\\r?\\n`\n\nExamples of matching strings: `\\n`, `\\r\\n`\n\n### addLineBreaks\n\n```php\n$regEx-\u003eaddLineBreaks();\n$regEx-\u003eaddLineBreaks(PHP_EOL);\n```\n\nAdds a partial expression that expects a 1..n line breaks.\nPer default `\\n` and `\\r\\n` will be recognized.\nYou may pass a parameter to define a specific line break pattern.\n\nExample resulting regex: `(\\r?\\n)+`\n\nExamples of matching strings: `\\n`, `\\n\\n`\n\n### addMaybeLineBreaks\n\n```php\n$regEx-\u003eaddMaybeLineBreaks();\n$regEx-\u003eaddMaybeLineBreaks(PHP_EOL);\n```\n\nAdds a partial expression that expects a 0..n line breaks.\nPer default `\\n` and `\\r\\n` will be recognized.\nYou may pass a parameter to define a specific line break pattern.\n\nExample resulting regex: `(\\r?\\n)*`\n\nExamples of matching strings: `\\n`, `\\n\\n`, empty string\n\n### addLineBeginning\n\n```php\n$regEx-\u003eaddLineBeginning();\n```\n\nAdds a partial expression that expects the beginning of a line.\nLine breaks mark the beginning of a line.\n\nExample of the resulting regex string: `^`\n\n### addLineEnd\n\n```php\n$regEx-\u003eaddLineEnd();\n```\n\nAdds a partial expression that expects the end of a line. \nLine breaks mark the end of a line.\n\nExample of the resulting regex string: `$`\n\n### addRange\n\n```php\n$regEx-\u003eaddRange('a-z', '123', '\\-');\n```\n\nAdds one ore more ranges to the overall regular expression and wraps them in a \"range\" expression.\nAvailable from-to-ranges: `a-z`, `A-Z`, `0-9`\n_ATTENTION_: This expression will not automatically quote its inner parts.\n\nExample of the resulting regex string: `[a-z123\\-]`\n\nExamples of matching strings: `a`, `1`, `-`\n\n\u003e This method uses the `RangeEx` expression class.\n\n### addInvertedRange\n\n```php\n$regEx-\u003eaddInvertedRange('a-z', '123', '\\-');\n```\n\nAdds one ore more ranges to the overall regular expression and wraps them in an inverted \"range\" expression.\nAvailable from-to-ranges: `a-z`, `A-Z`, `0-9`\n_ATTENTION_: This expression will not automatically quote its inner parts.\n\nExample of the resulting regex string: `[^a-z123\\-]`\n\nExamples of matching strings: `A`, `4`, `=`\n\n\u003e This method uses the `RangeEx` expression class.\n\n### addAnd\n\n```php\n$regEx-\u003eaddAnd('ht')-\u003eaddAnd('tp');\n```\n\nAdds one ore more partial expression to the overall regular expression and wraps them in an \"and\" expression.\nThis expression requires that all of its parts exist in the tested string.\n\nExample of the resulting regex string: `http`\n\nExample of matching string: `http`\n\n\u003e The `RegEx` class has a constructor that is an alias of the `addAnd` method: \n`new RegEx('ab')` will generate the same regular expression as `regEx-\u003eandAdd('ab')`.\n\n\u003e This method uses the `AndEx` expression class.\n\n### addOr\n\n```php\n$regEx-\u003eaddOr('http', 'https');\n```\n\nAdds at least two partial expressions to the overall regular expression and wraps them in an \"or\" expression.\nThis expression requires that one of its parts exists in the tested string.\n\nExample of the resulting regex string: `http|https`\n\nExamples of matching strings: `http`, `https`\n\n\u003e This method uses the `OrEx` expression class.\n\n### addOption\n\n```php\n$regEx-\u003eaddAnd('http')-\u003eaddAnd('s');\n```\n\nAdds one ore more partial expressions to the overall regular expression and wraps them in an \"optional\" expression.\nThe parts of this expression may or may not exist in the tested string.\n\nExample of the resulting regex string: `https(s)?`\n\nExamples of matching strings: `http`, `https`\n\n\n\u003e This method uses the `OptionEx` expression class.\n\n### addRepetition\n\n```php\n$regEx-\u003eaddRepetition(0, 1, \"ab\"); // Produces \"ab?\" and matches \"ab\" and empty string\n$regEx-\u003eaddRepetition(1, 1, \"ab\"); // Produces \"ab\" and matches \"ab\"\n$regEx-\u003eaddRepetition(1, 2, \"ab\"); // Produces \"ab{1,2}\" and matches \"ab\" and \"abab\".\n$regEx-\u003eaddRepetition(0, RepetitionEx::INFINITE, \"ab\"); // Produces \"ab*\" and matches 0..n \"ab\"\n$regEx-\u003eaddRepetition(1, RepetitionEx::INFINITE, \"ab\"); // Produces \"ab+\" and matches 1..n \"ab\"\n$regEx-\u003eaddRepetition(2, RepetitionEx::INFINITE, \"ab\"); // Produces \"ab{2,}\" and matches 2..n \"ab\"\n```\n\nAdds one ore more partial expressions to the total regular expression and wraps them in a \"repetition\" expression.\nExpects the minimum and the maximum of repetitions as the first two arguments.\nThe parts of this expression have to appear `$min` to `$max` times in the tested string.\n\n\u003e This method uses the `RepetitionEx` expression class.\n\n### addCapturingGroup\n\n```php\n$regEx-\u003eaddCapturingGroup('test');\n```\n\nAdds one ore more partial expressions to the overall regular expression and wraps them in a \"capturing group\" expression.\nThis expression will be added to the matches when the overall regular expression is tested.\nIf you add more than one part these parts are linked by \"and\".\n\nExample of the resulting regex string: `(test)`\n\n\u003e This method uses the `CapturingGroupEx` expression class.\n\n### addComment\n\n```php\n$regEx-\u003eaddComment('This is a comment');\n```\n\nAdd one ore more comments to the overall regular expression and wrap them in a \"comment\" expression.\nThis expression will not automatically quote its its inner parts.\n_ATTENTION_: Comments are not allowed to include any closing brackets ( \")\" )! Quoting them will not work.\n\nExample of the resulting regex string: `(?#This is a comment)`\n\n\u003e Consider to use PHP comments in favor of regular expression comments.\n\n\u003e This method uses the `CommentEx` expression class.\n\n## Miscellaneous methods\n\n### quote\n\n```php\n$quoted = $regEx-\u003equote('Hello.')\n```\n\nQuotes (escapes) regular expression characters and returns the result. \nExample: `Hello.` =\u003e `Hello\\.`\n\n### setModifier\n\n```php\n$regEx-\u003esetModifier(RegEx::MULTI_LINE_MODIFIER_SHORTCUT, true);\n```\n\nActivates or deactivates a modifier. \nThe current state of the modifier does not matter, so for example you can \n(pseudo-)deactivate a modifier before ever activating it.\n\n[Learn more about modifiers...](http://php.net/manual/en/reference.pcre.pattern.modifiers.php)\n\n### setInsensitiveModifier etc.\n\n```php\n$regEx-\u003esetInsensitiveModifier();\n$regEx-\u003esetInsensitiveModifier(true);\n$regEx-\u003esetInsensitiveModifier(false);\n```\n\nActivates or deactivates the \"insensitive\" (\"i\") modifier.\nThere are setters for all modifiers.\n\n### getActiveModifiers\n\n```php\n$modifiers = $regEx-\u003egetActiveModifiers();\n```\n\nReturns an array with the modifier shortcuts that are currently active.\n\n### isModifierActive()\n\n```php\n$active = $regEx-\u003eisModifierActive(RegEx::MULTI_LINE_MODIFIER_SHORTCUT);\n```\n\nDecides if a modifier is active or not\n\n### test\n\n```php\n$matches = $regEx-\u003etest('https//www.example.com/');\n```\n\nTests a given subject (a string) against the regular expression.\nReturns the matches.\nThrows an exception if an error occurs while testing.\n\n### replace\n\n```php\n$modified = $regEx-\u003ereplace('like', 'We hate to hate code');\n```\n\nPerforms search and replace with the regular expression.\nReturns the modified string.\nThrows an exception if an error occurs while replacing.\n\n### traverse\n\n```php\n$regEx-\u003etraverse(function($expression, int $level, bool $hasChildren)\n{\n    var_dump($expression, $level, $hasChildren);\n});\n```\n\nCall this method if you want to traverse it and all of it child expressions, \nno matter how deep they are nested in the tree. You only have to pass a closure, \nyou do not have to pass an argument for the level parameter. \nThe callback will have three arguments: The first is the child expression \n(an object of type AbstractExpression or a string | int | float), \nthe second is the level of that expression and the third tells you if \nit has children.\n\n### clear\n\n```php\n$regEx-\u003eclear();\n```\n\nResets the regular expression.\n\n### getSize\n\n```php\n$flatSize = $regEx-\u003egetSize();\n$deepSize = $regEx-\u003egetSize(true);\n```\nReturns the number of partial expressions. \nIf the parameter is false, only the partial expressions on the root level are counted. \nIf the parameter is true, the method traverses trough all partial expressions and counts \nall partial expressions without sub expressions. Or with other words: If you imagine \nthe regular expression as a tree then this method will only count its leaves.\n\n### getExpressions\n\n```php\n$expressions = $regEx-\u003egetExpressions();\n```\n\nGetter for the partial expressions array.\n\n### getStart\n\n```php\n$start = $regEx-\u003egetStart()\n```\n\nGetter for the \"start\" property\n\n### setStart\n\n```php\n$regEx-\u003esetStart('/')\n```\n\nSetter for the \"start\" property. \nThis is a raw string.\n\n### getEnd\n\n```php\n$end = $regEx-\u003egetEnd()\n```\n\nGetter for the \"end\" property. \nThis is a raw string - it is not quoted.\n\n### setEnd\n\n```php\n$regEx-\u003esetEnd('/')\n```\n\nSetter for the \"end\" property\n\n### getVisualisation\n\n```php\n$visualisation = $regEx-\u003egetStructure(false);\necho $visualisation;\n```\n\nReturns a \"visualisation\" of the structure of the regular expression. \nThis might be helpful if you want to understand how the regular expression is built. \nIf the parameter is set to true, the result may include HTML tags. \n\nExample output:\n```\nAndEx (Size: 1): (?:line)\n  string: line\nRawEx (Size: 1): (?:\\r?\\n*)\n  string: \\r?\\n*\nAndEx (Size: 1): (?:break)\n  string: break\n```\n\n### toString\n\n```php\n$stringified = $regEx-\u003etoString();\n```\n\nReturns the concatenated partial regular expressions as a string.\nThe magic method `__toString` has been implemented as well so you may convert the `RegEx` object to a string.\n\n## PHPVerbalExpressions\n\nRegEx has been inspired by [PHPVerbalExpressions](https://github.com/VerbalExpressions/PHPVerbalExpressions).\nIt is not better than VerbalExpressions but different. RegEx makes more use of OOP principles. \nTherefore it is better suited to mimic the structure of a regular expression. \nOn the downside it is a little bit more complex.\n\n## General notes\n\n* Contributions welcome. Do not hesitate to create issues and pull requests. Let me know if you miss a method.\n\n* If you want to test your regular expression, you may try an [online regex tester](http://www.phpliveregex.com/).\n\n* Why the extensive use of (not capturing) groups? Well, to me it is not very intuitive that \"ab*\" is the same as\n\"(?:ab)*\". Always using (non capturing) groups emphasizes the structure of a regular expression.\n\n* Official PHP documentation about the syntax of regular expressions: http://php.net/manual/de/reference.pcre.pattern.syntax.php\n\n* The code of this library is formatted according to the code style defined by the \n[PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) standard.\n\n* Status of this repository: _Maintained_. Create an [issue](https://github.com/chriskonnertz/RegEx/issues) \nand you will get a response, usually within 48 hours.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriskonnertz%2Fregex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchriskonnertz%2Fregex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriskonnertz%2Fregex/lists"}