Search by

jhinkelmann / regex-helper

jhinkelmann

There is no license information available for the latest version (dev-master) of this package.

A simple Regex Helper that simply nobody should actually use

Package info

github.com/jhinkelmann/regex-helper

pkg:composer/jhinkelmann/regex-helper

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2026-11-23 14:09 UTC

This package is not auto-updated.

Last update: 2026-11-24 12:43:45 UTC


README

The package has three main functions:

  • RegexHelper::isValidEmail
  • RegexHelper::extractNumbers
  • RegexHelper::maskSensitiveData

It also has another function that can be used to generally match regexes it is called whit RegexHelper::match.

The package will emit debug information to stdout if the environment variable TESTENV is set to testing.

validation

The regexes are stored without the by php requested starting and end "/" the options can be added in the match function.

Generally it is not recommended to use regex to validate E-Mails neither is it to recognize telephone numbers. Because of this the library will only recognize a subset of E-Mail addresses furthermore the matching of telephone numbers in maskSensitiveData by default generalizes to recognizing any number to make sure that it catches all. If a less aggressive matching for telephone number is wanted the library also has a regex for that purpose called $FILTERGermanTelephoneNumbers it trys to match german telephone numbers that comply with: Din 5008 or E.123 it also needs the correct spacing to be present.

The extractNumbers function extracts all digits from a string doing so it trys to figure out if the number is using a dot or a comma as a decimal point the other one can then be used to separate each hundredth of a number if no previous match was found it will fall back to any number \d*. The result of the function is ordert in the same order as in which the numbers where in the text.

list of predefined regexes

  • ´RegexHelper::$FILTEREMAILS´
  • ´RegexHelper::$FILTERTelephoneNumbers´
  • ´RegexHelper::$FILTERKreditkardNummer´
  • ´RegexHelper::$FILTERGermanTelephoneNumbers´

recommendation

DO NOT USE THIS!! for anything else but extracting Numbers