refiddle-com
refiddle-com copied to clipboard
PHP and Java Runners
In response to the wiki page on regex runners, I made an attempt at writing one for PHP. Here is a for a PHP regex runner. Notify my if it needs changes.
Thanks for taking the time to do this. Couple things I'd need before I could test it and put it up:
- List of regex options that PHP supports and the corresponding regex letter. For example 'i' in /A-Z/i for a case insensitive match.
- Double check that preg_match_all parses a 'literal' regex. If not, you'd need to add your own parser to split a regex literal into the pattern and options.
- Support corpus tests in the evaluate script.
It was my pleasure! I've addressed the items you listed, here is the new code.
In response to the second item in your list, I use the following test strings to test both the evaluate code and the replace code:
$pattern = '/eat (apple|pear)/';
$corpus_text = "I like to eat apples on a rainy day, but on sunny days, I like to eat pears.";
$replace_text = 'eat yummy things';