All Projects → T-Regx → T Regx

T-Regx / T Regx

Licence: mit
Library for PHP regular expression, providing high-level API.

Projects that are alternatives of or similar to T Regx

Ruby Regexp
Learn Ruby Regexp step by step from beginner to advanced levels with plenty of examples and exercises
Stars: ✭ 79 (-69.96%)
Mutual labels:  regular-expressions
python-hyperscan
A CPython extension for the Hyperscan regular expression matching library.
Stars: ✭ 112 (-57.41%)
Mutual labels:  regular-expressions
Regular Expressions
🔍 Swirl course on regular expressions and the regex family of functions in R
Stars: ✭ 21 (-92.02%)
Mutual labels:  regular-expressions
url-regex-safe
Regular expression matching for URL's. Maintained, safe, and browser-friendly version of url-regex. Resolves CVE-2020-7661 for Node.js servers.
Stars: ✭ 59 (-77.57%)
Mutual labels:  regular-expressions
tokenquery
TokenQuery (regular expressions over tokens)
Stars: ✭ 28 (-89.35%)
Mutual labels:  regular-expressions
sylbreak
Syllable segmentation tool for Myanmar language (Burmese) by Ye.
Stars: ✭ 44 (-83.27%)
Mutual labels:  regular-expressions
moar
Deterministic Regular Expressions with Backreferences
Stars: ✭ 19 (-92.78%)
Mutual labels:  regular-expressions
Pawn.Regex
🔎 Plugin that adds support for regular expressions in Pawn
Stars: ✭ 34 (-87.07%)
Mutual labels:  regular-expressions
ostrich
An SMT Solver for string constraints
Stars: ✭ 18 (-93.16%)
Mutual labels:  regular-expressions
lc-data-intro
Library Carpentry: Introduction to Working with Data (Regular Expressions)
Stars: ✭ 16 (-93.92%)
Mutual labels:  regular-expressions
simplematch
Minimal, super readable string pattern matching for python.
Stars: ✭ 147 (-44.11%)
Mutual labels:  regular-expressions
expressive-ts
A functional programming library designed to simplify building complex regular expressions
Stars: ✭ 78 (-70.34%)
Mutual labels:  regular-expressions
unmatcher
Regular expressions reverser for Python
Stars: ✭ 26 (-90.11%)
Mutual labels:  regular-expressions
readable-regex
Java library for creating readable regular expressions
Stars: ✭ 24 (-90.87%)
Mutual labels:  regular-expressions
RgxGen
Regex: generate matching and non matching strings based on regex pattern.
Stars: ✭ 45 (-82.89%)
Mutual labels:  regular-expressions
ChatControl-Pro
The ultimate chat solution. Prevent spam, ads, swears and even bots on your server. Replaced by ChatControl Red: https://mineacademy.org/chatcontrol-red
Stars: ✭ 65 (-75.29%)
Mutual labels:  regular-expressions
convey
CSV processing and web related data types mutual conversion
Stars: ✭ 16 (-93.92%)
Mutual labels:  regular-expressions
Sistem-programlama
Sistem Programlama Türkçe Kaynak (KTÜ)
Stars: ✭ 30 (-88.59%)
Mutual labels:  regular-expressions
crystular
Crystal regex tester http://www.crystular.org/
Stars: ✭ 31 (-88.21%)
Mutual labels:  regular-expressions
regularize
Regular Expression Builder for Python
Stars: ✭ 17 (-93.54%)
Mutual labels:  regular-expressions

T-Regx

T-Regx | Regular Expressions library

PHP regular expressions brought up to modern standards.

See documentation at t-regx.com.

last commit commit activity Unit tests Repository size FQN PRs Welcome

PHP Version PHP Version PHP Version PHP Version PHP Version

  1. Installation
  2. API
  3. Documentation
  4. T-Regx fiddle - Try online
  5. Overview
  6. Comparison
  7. License

Installation

Installation for PHP 7.1 and later (PHP 8 as well):

composer require rawr/t-regx

API

You, choose the interface:

  • I choose to keep PHP methods (but protected from errors):

    Scroll to see - preg::match_all(), preg::replace_callback(), preg::split()

  • I choose the modern regex API:

    Scroll to see - pattern()->test(), pattern()->match(), pattern()->replace()

Documentation

Full API documentation is available at t-regx.com. List of changes is available in ChangeLog.md.

Try it online, in your browser!

Open T-Regx fiddle and start playing around.

Why T-Regx stands out?

💡 See documentation at t-regx.com

  • No change in API!

    • You can use T-Regx safe features and exception-based error handling, without changing your API.

      Simply swap preg_match() to preg::match(), and your method is safe! Arguments and return types remain the same.

  • Prepared patterns

    Using user data (for example with preg_quote()) isn't always safe with PCRE, as well as just not being that convenient to use. T-Regx provides Pattern::inject() and Pattern::bind() methods, designed specifically for handling potentially unsafe data. Pattern::format() allows converting user-supplied masks into full-fledged patterns safely.

  • Working with the developer

  • Automatic delimiters for your pattern

    Surrounding slashes or tildes (/pattern/ or ~patttern~) are not compulsory.

  • Converting Warnings/Errors to Exceptions

    • Malformed patterns in preg_() methods don't make preg_last_error() to return error.
    • Notices, warnings or errors during preg:: are converted to exceptions.
    • preg_() can never fail, because it throws PregException on warning/error.
    • In some cases, preg_() methods might fail, return false/null and NOT trigger a warning. Separate exception, SuspectedReturnPregException is then thrown by T-Regx.
  • Written with clean API

    • Descriptive, chainable interface
    • SRP methods
    • UTF-8 support out-of-the-box
    • No Reflection used, No (...varargs), No (boolean arguments, true), (No flags, 1) , [No [nested, [arrays]]]
  • Protects your from fatal errors

    Certain arguments cause fatal errors with preg_() methods. T-Regx will throw a catchable exception, instead of a Fatal Error.

What's better

Ugly api

or

Pretty api

Sponsors

Andreas Leathley - developing SquirrelPHP

T-Regx is developed thanks to

JetBrains

License

T-Regx is MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].