The best Stargazers!
The amount of stargazers just hit 30! We really appreciate your community recognition :) Thank you, for being out there.
The amount of stargazers just hit 30! We really appreciate your community recognition :) Thank you, for being out there.
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.
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!
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.
One update about groups, not to cause confusion. $match->groups()
treats indexes a bit different than $match->group(int)
.
Read on to learn more :)
Hello there! Another update, this time there's more to it - much has changed.
Here's a quick list:
PHP 5.3
Match
and ReplaceMatch
).Pattern::of()
In addition, I'd like to give a quick thanks to Bartek - my friend currently working at Thulium - for a nice suggestion :)
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.
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.
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:
null
s, false
es and empty and nested arrays with clean APIpreg_
methodsHello, 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!