Skip to content

hirakc/PHPVerbalExpressions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

##PHPVerbalExpressions

VerbalExpressions is a PHP library that helps to construct hard regular expressions.

// some tests

$regex = new VerbalExpressions;

$regex 	->startOfLine()
		->then("http")
		->maybe("s")
		->then("://")
		->maybe("www.")
		->anythingBut(" ")
		->endOfLine();


if($regex->test("http://github.com"))
	echo "valid url";
else
	echo "invalid url";

if (preg_match($regex, 'http://github.com')) {
	echo 'valid url';
} else {
	echo 'invalud url';
}


echo "<pre>". $regex->getRegex() ."</pre>";



echo $regex ->clean(array("modifiers" => "m", "replaceLimit" => 4))
			->find(' ')
			->replace("This is a small test http://somesite.com and some more text.", "-");

Other Implementations

You can see an up to date list of all ports on VerbalExpressions.github.io.

About

PHP Regular expressions made easy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%