Test the PHP function preg_match

This PHP preg_match online tool is design for you to try patterns on an input.


preg_match is a PHP function that test a pattern to a string or a text set in input.
The return will be a boolean value true or false. The pattern is a regular expression. Matches can be return by the function in a variable.

Our tool will show you both results : the boolean and the matched value.
It will help you to test a pattern without having to update your script several time. It is easy to use. You just have to copy the input and the pattern in the form and hit the button.

About patterns here are some information which may help you to build one :

Element Description
// Start and end delimiters
^ Meaning that the input has to start at this point of the pattern
$ Meaning that the input has to end at this point of the pattern
(.*?) Matches pretty much all the values possibles at this place, I actually use it a lot when I don't have to worry about unsafe values.
([0-9]) One digit between 0 and 9
([0-9]{3}) 3 digits between 0 and 9. You just have to change the 3 buy any length.
([0-9]*) All digits between 0 and 9, it is an unlimited length.
([a-zA-Z]*) All alphabetic strings


Example
/^([0-9a-zA-Z]*)$/

It will return true to all alphanumeric strings put in input.


 FR     EN  

Copyright 2024 -   Contact us - 2024-03-29 13:58:43