Giter Club home page Giter Club logo

easy-regex's Introduction

easy-regex

PHP Regular expressions made easy

codecov example workflow License Latest Stable Version PHP version Build Status

Prerequisites

You need them before installing the package.

  • You need PHP 7.2.5 or above
  • You composer 2.3 or above

Installation

composer require azibom/easy-regex

Usage

<?php

require 'vendor/autoload.php';

use Azibom\EasyRegex\Builder;

$builder = new Builder();
$builder
    ->start()
    ->see("http")
    ->maybeSee("s")
    ->see("://")
    ->something()
    ->see(".")
    ->something()
    ->end();

echo $builder->getRegex() . PHP_EOL; 

if ($builder->match("https://google.com")) {
    echo "Match found!" . PHP_EOL;
} else {
    echo "No match." . PHP_EOL;
}

// /^(http)(s)?(\:\/\/)(?:.+)(\.)(?:.+)$/
// Match found!

Roadmap

The goal of this project is to make a complete regex helper library for the PHP language.

Contribution

Any contribution in the form of an issue or a pull request is more than welcome! Also if you have any questions, feel free to create a new issue or comment on existing ones.

easy-regex's People

Contributors

azibom avatar

Stargazers

محمدجواد صیدی avatar Ali Najafi avatar Hossein Zeinali avatar  avatar Alireza Shabani avatar

Watchers

 avatar

Forkers

ashermoshav

easy-regex's Issues

Add a function to builder to get all mathes value and not just one

Add a function to the builder class to get all match values and not just one.
You should define a property for the builder class and then change its value by calling your function.
Your function name can be like getAllMatches or sth like this and use preg_match_all inside it for finding all matches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.