Build your regular expressions based on your texts. It has never been easier to create regular expressions.
<?php
require 'vendor/autoload.php';
$regex = new Words2Regex\Words2Regex();
$words = [
'abc', 'abcde', 'abcdef',
'bbc', 'bbcde', 'bbcdef',
'cbc', 'cbcde', 'cbcdef',
];
foreach ($words as $word)
{
$regex->add($word);
}
echo $regex->getRegex();
Output2:
([abc]bc(def?)?)
<?php
require 'vendor/autoload.php';
$regex = new Words2Regex\Words2Regex();
$words = [
'foo', 'foobar'
];
foreach ($words as $word)
{
$regex->add($word);
}
echo $regex->getRegex();
Output2:
foo(bar)?