Skip to main content

The best Stargazers!

The amount of stargazers just hit 30! We really appreciate your community recognition :) Thank you, for being out there.

Match details update

Most changes in T-Regx since the last Blog post were to Match details. We added user data (getUserData()/setUserData()) which can be used in chained calls (e.g. filter()->map()).

The second change is isInt()/parseInt() which allow you to handle "real" integers safetly - without the fear of "PHP smart" integers (e.g. PHP thinks that "1e3" is 1000). T-Regx understands that robust applications can't allow numbers to be 10e4 - it should be treated as an invalid integer by default!

And last, Match.group(int|string) is now validated (T-Regx was waiting a bit for this change!). We believe that using an invalid group name is a sign of a bug, so using group(-1) or group('!@#') now throws \InvalidArgumentException, as it's more suitable than assuming that -1 is just an unmatched group.

Santa Clause Day Update

So over 2 months have passed since the last blog entry - much have changed. It's all described in ChangeLog.md on github, so there's no reason for rewriting it again.

One big change is Prepared Patterns - which lets you handle user input or unsafe characters in your patterns. It's got a dedicated section in Docs, too.

Except for that, there's a discussion section in Help - feel free to ask questions or propose features!

Welcome T-Regx

The library changes its name! Now it's called T-Regx! It's a combination of words "T-Rex" - the dinosaur - and "RegExp".

Also, I've invested much more time into the development of CleanRegex T-Regx. Read on, for a detailed list of features.

Support for PHP 5.3

Hello there! Another update, this time there's more to it - much has changed.

Here's a quick list:

  • ReadMe.md is now more throughout
  • CleanRegex runs on Travis and Coveralls
  • The library can now be required using Composer
  • CleanRegex supports PHP 5.3
  • Handling compile pattern exceptions and runtime pattern exceptions
  • Passing callbacks with detailed object parameters (Match and ReplaceMatch).
  • Add a facade Pattern::of()

In addition, I'd like to give a quick thanks to Bartek - my friend currently working at Thulium - for a nice suggestion :)

What's new, new, new!

Another quickly update what's going on with CleanRegex :)

Most important of these two is that patterns used with CleanRegex no longer need delimiters :> I'm pretty happy with it, I don't see any reason why developers should keep including those.

How delimiting works? CleanRegex has a number of potential delimiters. At first, it checks whether a pattern is already delimited and if it's not, it adds a potential delimiter - one that isn't used in a pattern. Then in adds the flags :) As simple as that.

What's new, new, new! Part 2

I've separated the library into CleanRegex and SafeRegex. The SafeRegex is an exact copy of all preg_*() methods (like preg_match(), preg_replace()). They're used like this:

  • preg_match() -> preg::match()
  • preg_replace() -> preg::replace()

I didn't want to use namespaces (like \SafeRegex\preg_match) because that would mean the programmers reading the code would have to check the imported namespaces every time they look at the code. With double colon :: it's obvious. Read on, for more details.

Back on track!

I'm here just to give you guys, a quick update and sum up what's been going on.

So, I'm pretty happy with how's the lib looking right now. :) There's a pretty throughout ReadMe.md there on CleanRegex github, but I bet you I'll expand it with more examples. :)

The library, actually, already looks like how I imagined it and how I will try to make it look in the end, which is:

  • Based on exceptions
  • Overly simple set of chainable methods
  • Wrapping nulls, falsees and empty and nested arrays with clean API
  • Removing any false-negative with PHP preg_ methods

Hello, World!

Hello, there! I'm very pleased to inform you that I've just started working on an open source Regular Expressions library for PHP. :> I'm really passionate about it and I hope we'll get along really nicely!