Merge branch '1.1.x'
This commit is contained in:
@@ -44,8 +44,8 @@ class RegexPatterns {
|
||||
protected static final Pattern ANY_DATE = Pattern.compile('(\\d\\d\\d\\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])')
|
||||
protected static final Pattern ANY_DATE_TIME = Pattern.compile('([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])')
|
||||
protected static final Pattern ANY_TIME = Pattern.compile('(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])')
|
||||
protected static final Pattern NON_EMPTY = Pattern.compile(/.+/)
|
||||
protected static final Pattern NON_BLANK = Pattern.compile(/.*(\S+|\R).*|!^\R*$/)
|
||||
protected static final Pattern NON_EMPTY = Pattern.compile(/[\S\s]+/)
|
||||
protected static final Pattern NON_BLANK = Pattern.compile(/^\s*\S[\S\s]*/)
|
||||
protected static final Pattern ISO8601_WITH_OFFSET = Pattern.compile(/([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.\d{3})?(Z|[+-][01]\d:[0-5]\d)/)
|
||||
|
||||
protected static Pattern anyOf(String... values){
|
||||
|
||||
@@ -229,20 +229,28 @@ class RegexPatternsSpec extends Specification {
|
||||
expect:
|
||||
shouldMatch == Pattern.compile(regexPatterns.nonBlank()).matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'Not Empty' || true
|
||||
'' || false
|
||||
' ' || false
|
||||
textToMatch || shouldMatch
|
||||
'Not Empty' || true
|
||||
'' || false
|
||||
' ' || false
|
||||
'\nFoo\nBar\n' || true
|
||||
'\r\n' || false
|
||||
' \r\n\t\f' || false
|
||||
|
||||
}
|
||||
|
||||
def "should generate a regex for a non empty string [#textToMatch] that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == Pattern.compile(regexPatterns.nonEmpty()).matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'Not Empty' || true
|
||||
'' || false
|
||||
' ' || true
|
||||
textToMatch || shouldMatch
|
||||
'Not Empty' || true
|
||||
'' || false
|
||||
' ' || true
|
||||
'\nFoo\nBar\n' || true
|
||||
'\r\n' || true
|
||||
' \r\n\t\f' || true
|
||||
|
||||
}
|
||||
|
||||
def "should generate a regex for an enumerated value [#textToMatch] that should match [#shouldMatch]"(){
|
||||
|
||||
Reference in New Issue
Block a user