<commit_before>ldrahnik/regexp
======

[![Build Status](https://travis-ci.org/ldrahnik/regexp.svg)](https://travis-ci.org/ldrahnik/regexp)
[![Latest stable](https://img.shields.io/packagist/v/ldrahnik/regexp.svg)](https://packagist.org/packages/ldrahnik/regext)

Set of regular expressions.

Requirements
------------

ldrahnik/regexp requires PHP 5.3.3 or higher.

Installation
------------

Install regexp to your project using  [Composer](http://getcomposer.org/):

```sh
$ composer require ldrahnik/regexp:~0.9
```
<commit_msg>Updated readme.md to v1.0<commit_after>ldrahnik/regexp
======

[![Build Status](https://travis-ci.org/ldrahnik/regexp.svg)](https://travis-ci.org/ldrahnik/regexp)
[![Latest stable](https://img.shields.io/packagist/v/ldrahnik/regexp.svg)](https://packagist.org/packages/ldrahnik/regext)

Set of regular expressions.

Requirements
------------

ldrahnik/regexp requires PHP 5.3.3 or higher.

Installation
------------

Install regexp to your project using  [Composer](http://getcomposer.org/):

```sh
$ composer require ldrahnik/regexp:~0.9
```

Usage
-----

Register extension in config file

```sh
extensions:
	regexp: regexp\DI\RegexpHelperExtension

regexp:
	myRegularName: ^[0-9]{1,10}$
	twitterUsername: foo
```

You are able to override already existing embedded regular expressions

```sh
'username' => '^[a-z0-9_-]{3,16}$',
'twitterUsername' =>  '^(\@)?[A-Za-z0-9_]+$',
'password' => '^[a-z0-9_-]{6,18}$',
'facebook' => '^(https?:\/\/)?(www\.)?facebook.com\/[a-zA-Z0-9(\.\?)?]',
'google' => '((http|https):\/\/)?(www[.])?plus\.google\.com\/.?\/?.?\/?([0-9]*)'
```

Now you can use all regulars through services

```php
	/** @var \regexp\Regexp */
	private $regexpServices;

    public function __construct(regexp\Regexp $regexpServices)
    {
		    $this->regexpServicesc = $regexpServices;
    }
    
    public function test()
    {
        $regular = $this->regexpServices->getRegularExpression('twitterUsername');
    }
```
{'fraction_non_alphanumeric': 0.22086513994910942, 'fraction_numerical': 0.016793893129770993, 'mean_word_length': 3.806845965770171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3536506', 'n_tokens_mistral': 753, 'n_tokens_neox': 733, 'n_words': 119}