[LANG-1238] Add RegexUtils class instead of overloadinh methods in
StringUtils that take a regex to take precompiled Pattern. Use 120 chars per line.
This commit is contained in:
parent
54acb6e10f
commit
bd4066eba8
|
@ -26,8 +26,7 @@ import java.util.regex.PatternSyntaxException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for methods of {@link org.apache.commons.lang3.RegExUtils}
|
* Unit tests for methods of {@link org.apache.commons.lang3.RegExUtils} which been moved to their own test classes.
|
||||||
* which been moved to their own test classes.
|
|
||||||
*/
|
*/
|
||||||
public class RegExUtilsTest {
|
public class RegExUtilsTest {
|
||||||
|
|
||||||
|
@ -173,8 +172,7 @@ public class RegExUtilsTest {
|
||||||
assertEquals("ABC___123", RegExUtils.replaceAll("ABCabc123", "[a-z]", "_"));
|
assertEquals("ABC___123", RegExUtils.replaceAll("ABCabc123", "[a-z]", "_"));
|
||||||
assertEquals("ABC_123", RegExUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_"));
|
assertEquals("ABC_123", RegExUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_"));
|
||||||
assertEquals("ABC123", RegExUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", ""));
|
assertEquals("ABC123", RegExUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", ""));
|
||||||
assertEquals("Lorem_ipsum_dolor_sit",
|
assertEquals("Lorem_ipsum_dolor_sit", RegExUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2"));
|
||||||
RegExUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2"));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
RegExUtils.replaceAll("any", "{badRegexSyntax}", "");
|
RegExUtils.replaceAll("any", "{badRegexSyntax}", "");
|
||||||
|
|
Loading…
Reference in New Issue