xp-framework / patterns
Pattern matching
Installs: 4 836
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.0.0
- xp-framework/core: ^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.0
Requires (Dev)
- xp-framework/unittest: ^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.0
README
Regular expressions and text scanning
Example
use text\regex\Pattern; $pattern= Pattern::compile('([w]{3}\.)?example\.(com|net|org)'); if ($pattern->matches($input)) { // Looks like an example domain } $result= $pattern->match($input); $group= $result->group(0); // [ "www.example.com", "www.", "www", "com" ]