doc / ch.tutteli.atrium.api.cc.en_GB / regex

regex

fun <T : CharSequence> CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>.regex(pattern: String, vararg otherPatterns: String): AssertionPlant<T>
Deprecated: Switch from api-cc-en_GB to api-fluent-en_GB; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.9.0#migration for migration hints and scripts.

Finishes the specification of the sophisticated contains assertion where the given regular expression pattern as well as the otherPatterns are expected to have a match, using a non disjoint search.

By non disjoint is meant that 'aa' in 'aaaa' is found three times and not only two times. Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'ab' and pattern is defined as 'a(b)?' and one of the otherPatterns is defined as 'a(b)?' as well, then both match, even though they match the same sequence in the input of the search. Use an option such as atLeast, atMost and exactly to control the number of occurrences you expect.

Meaning you might want to use: contains.exactly(2).regex('a(b)?') instead of: contains.atLeast(1).regex('a(b)?', 'a(b)?')

Parameters

pattern - The pattern which is expected to have a match against the input of the search.

otherPatterns - Additional patterns which are expected to have a match against the input of the search.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
The AssertionPlant for which the assertion was built to support a fluent API.

@JvmName("regexIgnoringCase") fun <T : CharSequence> CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>.regex(pattern: String, vararg otherPatterns: String): AssertionPlant<T>
Deprecated: Switch from api-cc-en_GB to api-fluent-en_GB; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.9.0#migration for migration hints and scripts.

Finishes the specification of the sophisticated contains assertion where the given regular expression pattern as well as the otherPatterns are expected to have a match (ignoring case), using a non disjoint search.

By non disjoint is meant that 'aa' in 'aaaa' is found three times and not only two times. Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'ab' and pattern is defined as 'a(b)?' and one of the otherPatterns is defined as 'a(b)?' as well, then both match, even though they match the same sequence in the input of the search. Use an option such as atLeast, atMost and exactly to control the number of occurrences you expect.

Meaning you might want to use: contains.ignoringCase.exactly(2).regex('a(b)?') instead of: contains.ignoringCase.atLeast(1).regex('a(b)?', 'a(b)?')

Parameters

pattern - The pattern which is expected to have a match against the input of the search.

otherPatterns - Additional patterns which are expected to have a match against the input of the search.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
The AssertionPlant for which the assertion was built to support a fluent API.

fun <T : CharSequence> CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour>.regex(pattern: String, vararg otherPatterns: String): AssertionPlant<T>
Deprecated: Switch from api-cc-en_GB to api-fluent-en_GB; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.9.0#migration for migration hints and scripts.

Finishes the specification of the sophisticated contains assertion where the given regular expression pattern as well as the otherPatterns are expected to to have at least one match (ignoring case), using a non disjoint search.

Delegates to atLeast(1).regex(pattern, otherPatterns)

By non disjoint is meant that 'aa' in 'aaaa' is found three times and not only two times. Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'ab' and pattern is defined as 'a(b)?' and one of the otherPatterns is defined as 'a(b)?' as well, then both match, even though they match the same sequence in the input of the search. Use an option such as atLeast, atMost and exactly to control the number of occurrences you expect.

Meaning you might want to use: contains.ignoringCase.exactly(2).regex('a(b)?') instead of: contains.ignoringCase.atLeast(1).regex('a(b)?', 'a(b)?')

Parameters

pattern - The pattern which is expected to have a match against the input of the search.

otherPatterns - Additional patterns which are expected to have a match against the input of the search.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
The AssertionPlant for which the assertion was built to support a fluent API.