refiddle-com icon indicating copy to clipboard operation
refiddle-com copied to clipboard

PHP and Java Runners

Open FelisPhasma opened this issue 10 years ago • 2 comments

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.

FelisPhasma avatar Dec 02 '15 04:12 FelisPhasma

Thanks for taking the time to do this. Couple things I'd need before I could test it and put it up:

  1. List of regex options that PHP supports and the corresponding regex letter. For example 'i' in /A-Z/i for a case insensitive match.
  2. 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.
  3. Support corpus tests in the evaluate script.

phallguy avatar Dec 02 '15 21:12 phallguy

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';

FelisPhasma avatar Dec 03 '15 00:12 FelisPhasma