public static boolean isAnchorMatched(HTTPSamplerBase newLink, HTTPSamplerBase config)
    {
        String query;
        try {
            query = URLDecoder.decode(newLink.getQueryString(), StandardCharsets.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
            // UTF-8 unsupported? You must be joking!
            log.error("UTF-8 encoding not supported!");
            throw new Error("Should not happen: " + e.toString(), e);
        }

        final Arguments arguments = config.getArguments();

        if (USE_JAVA_REGEX) {
            return isAnchorMatchedWithJavaRegex(newLink, config, query, arguments);
        }
        return isAnchorMatchedWithOroRegex(newLink, config, query, arguments);
    }
@Test
    public void testIsAnchorMatched() throws Exception {
        HTTPSamplerBase target = new HTTPNullSampler();
        HTTPSamplerBase pattern = new HTTPNullSampler();

        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

        target.setProtocol("http:");
        assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

        pattern.setProtocol(".*");
        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

        target.setDomain("a.b.c");
        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

        pattern.setDomain(".*");
        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

        target.setPath("/abc");
        assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

        pattern.setPath(".*");
        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

        target.addArgument("param2", "value2", "=");
        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

        pattern.addArgument("param1", ".*", "=");
        assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

        target.addArgument("param1", "value1", "=");
        assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
    }