PHPRegexConverter { public static String convertPHPRegexPattern(String phpPattern) { if (StringUtils.hasText(phpPattern)) { return phpPattern.replaceFirst("^\\|(.*)\\|$", "$1"); } return phpPattern; } private  PHPRegexConverter(); static String convertPHPRegexPattern(String phpPattern);  }
@Test public void testConvertPHPRegexPattern_null() throws Exception { assertNull(PHPRegexConverter.convertPHPRegexPattern(null)); }
@Test public void testConvertPHPRegexPattern_noDelim() throws Exception { String in = "(.+)"; assertEquals(in, PHPRegexConverter.convertPHPRegexPattern(in)); }
@Test public void testConvertPHPRegexPattern_withDelim() throws Exception { String in = "|(.+)|"; String out = "(.+)"; assertEquals(out, PHPRegexConverter.convertPHPRegexPattern(in)); }
@Test public void testConvertPHPRegexPattern_multiDelim() throws Exception { String in = "|(person|group)|"; String out = "(person|group)"; assertEquals(out, PHPRegexConverter.convertPHPRegexPattern(in)); }