public static boolean matches(String pattern, String text)
	{
		final Matcher matcher = WILDCARD_PATTERN.matcher(pattern);
		final StringBuffer buffer = new StringBuffer();

		buffer.append("(?i)");
		while (matcher.find())
		{
			if (matcher.group(1) != null)
			{
				matcher.appendReplacement(buffer, ".*");
			}
			else
			{
				matcher.appendReplacement(buffer, Matcher.quoteReplacement(Pattern.quote(matcher.group(0))));
			}
		}

		matcher.appendTail(buffer);
		final String replaced = buffer.toString();

		return text.matches(replaced);
	}
@Test
	public void testMatches()
	{
		assertTrue(matches("rune*", "rune pouch"));
		assertTrue(matches("rune*", "Rune pouch"));
		assertFalse(matches("Abyssal whip", "Adamant dagger"));
		assertTrue(matches("rune*", "Runeite Ore"));
		assertTrue(matches("Abyssal whip", "Abyssal whip"));
		assertTrue(matches("string $ with special character", "string $ with special character"));
	}