Login   Register  
PHP Classes
elePHPant
Icontem

File: README.md

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of P Guardiario  >  PHP Str Match and Split  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/plain
Description: Documentation
Class: PHP Str Match and Split
Process strings with regular expressions
Author: By
Last change:
Date: 2013-01-23 01:00
Size: 571 bytes
 

Contents

Class file image Download
Phpstr
Give php strings easy to remember regex functionality
=========

Do you ever get tired of looking up preg functions because you forgot the order of the arguments? Me too.

```php
require 'phpstr.php';
```

Return a match
```php
str('There are 23 people reading this blog')->match('/\d+/');
```

Substitution
```php
str('all of the es')->gsub('/e/', 'y');
```

Scan will return an array of matches
```php
str('010 202 312 332')->scan('/\d+/');
```

Split will return an array of tokens
```php
str('010 202-312 332')->split('/\s/');
```