Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Powered[s]*[bB]y.*MyBB
- "Powered[\s]*[bB]y.*MyBB"
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- import org.junit.Assert;
- import org.junit.Test;
- public class RegexTest {
- @Test
- public void testPatternWithWhiteSpace(){
- Pattern pattern = Pattern.compile("Powered\s*[bB]y.*MyBB");
- Matcher matcher = pattern.matcher("Powered By MyBB");
- Assert.assertTrue(matcher.matches());
- matcher = pattern.matcher("Powered_By MyBB");
- Assert.assertFalse(matcher.matches());
- }
- }
- matcher = pattern.matcher("Poweredtnr By MyBB");
- Assert.assertTrue(matcher.matches());
- matcher = pattern.matcher("Poweredtnr ,By MyBB");
- Assert.assertFalse(matcher.matches());
Add Comment
Please, Sign In to add comment