Uses of Class
ru.lanwen.verbalregex.VerbalExpression.Builder
-
Uses of VerbalExpression.Builder in ru.lanwen.verbalregex
Methods in ru.lanwen.verbalregex that return VerbalExpression.BuilderModifier and TypeMethodDescriptionAppend literal expression Everything added to the expression should go trough this method (keep in mind when creating your own methods).VerbalExpression.Builder.add(VerbalExpression.Builder regex) Append a regex from builder and wrap it with unnamed group (?VerbalExpression.Builder.addModifier(char pModifier) Shortcut toVerbalExpression.Builder.anyOf(String)VerbalExpression.Builder.anything()Add expression that matches anything (includes empty string)VerbalExpression.Builder.anythingBut(String pValue) Add expression that matches anything, but not passed argumentVerbalExpression.Builder.atLeast(int from) Produce range count with only minimal number of occurrences for example: .find("w").atLeast(1) // produce (?VerbalExpression.Builder.br()Shortcut forVerbalExpression.Builder.lineBreak()VerbalExpression.Builder.capt()Shortcut forVerbalExpression.Builder.capture()Shortcut forVerbalExpression.Builder.capture(String)VerbalExpression.Builder.capture()Adds capture - open brace to current position and closed to suffixesAdds named-capture - open brace to current position and closed to suffixesVerbalExpression.Builder.count(int count) Add count of previous group for example: .find("w").count(3) // produce - (?VerbalExpression.Builder.count(int from, int to) Produce range count for example: .find("w").count(1, 3) // produce (?VerbalExpression.Builder.digit()Add same as [0-9]VerbalExpression.Builder.endCapt()Shortcut forVerbalExpression.Builder.endCapture()VerbalExpression.Builder.endCapture()Close brace for previous capture and remove last closed brace from suffixes Can be used to continue build regex after capture or to add multiply capturesVerbalExpression.Builder.endGr()Closes current unnamed and unmatching group Shortcut forVerbalExpression.Builder.endCapture()Use it withVerbalExpression.Builder.group()for prettify code Example: regex().group().maybe("word").count(2).endGr()VerbalExpression.Builder.endOfLine()Mark the expression to end at the last character of the line Same asVerbalExpression.Builder.endOfLine(boolean)with true argVerbalExpression.Builder.endOfLine(boolean pEnable) Enable or disable the expression to end at the last character of the lineAdd a string to the expression Syntax sugar forVerbalExpression.Builder.then(String)- use it in case: regex().find("string") // when it goes firstVerbalExpression.Builder.group()Same asVerbalExpression.Builder.capture(), but don't save result May be used to set count of duplicated captures, without creating a new saved capture Example: // Without group() - count(2) applies only to second capture regex().group() .capt().range("0", "1").endCapt().tab() .capt().digit().count(5).endCapt() .endGr().count(2);VerbalExpression.Builder.lineBreak()Add universal line break expressionAdd a string to the expression that might appear once (or not) Example: The following matches all strings that contain http:// or https:// VerbalExpression regex = regex() .find("http") .maybe("s") .then("://") .anythingBut(" ").build(); regex.test("http://") //true regex.test("https://") //trueVerbalExpression.Builder.maybe(VerbalExpression.Builder regex) Add a regex to the expression that might appear once (or not) Example: The following matches all names that have a prefix or not.Convenient method to show that string usage count is exact count, range count or simply one or more Usage: regex().multiply("abc") // Produce (?VerbalExpression.Builder.nonDigit()Add non-digit: [^0-9]VerbalExpression.Builder.nonSpace()Add non-whitespace character: [^\s]VerbalExpression.Builder.nonWordChar()Add non-word character: [^\w]Adds an alternative expression to be matched based on an array of valuesVerbalExpression.Builder.oneOrMore()Adds "+" char to regexp Same effect asVerbalExpression.Builder.atLeast(int)with "1" argument Also, used byVerbalExpression.Builder.multiple(String, int...)when second argument is null, or have length more than 2Add a alternative expression to be matched Issue #32Add expression to match a range (or multiply ranges) Usage: .range(from, to [, from, to ... ]) Example: The following matches a hexadecimal number: regex().range( "0", "9", "a", "f") // produce [0-9a-f]static VerbalExpression.BuilderVerbalExpression.regex()Creates new instance of VerbalExpression builderstatic VerbalExpression.BuilderVerbalExpression.regex(VerbalExpression.Builder pBuilder) Creates new instance of VerbalExpression builder from cloned builderVerbalExpression.Builder.removeModifier(char pModifier) VerbalExpression.Builder.searchOneLine(boolean pEnable) VerbalExpression.Builder.something()Add expression that matches something that might appear once (or more)VerbalExpression.Builder.somethingButNot(String pValue) VerbalExpression.Builder.space()Add whitespace character, same as [ \t\n\x0B\f\r]VerbalExpression.Builder.startOfLine()Mark the expression to start at the beginning of the line Same asVerbalExpression.Builder.startOfLine(boolean)with true argVerbalExpression.Builder.startOfLine(boolean pEnable) Enable or disable the expression to start at the beginning of the lineVerbalExpression.Builder.tab()Add expression to match a tab character (' ')Add a string to the expressionVerbalExpression.Builder.withAnyCase()Turn ON matching with ignoring case Example: // matches "a" // matches "A" regex().find("a").withAnyCase()VerbalExpression.Builder.withAnyCase(boolean pEnable) VerbalExpression.Builder.word()Add word, same as [a-zA-Z_0-9]+VerbalExpression.Builder.wordBoundary()Add word boundary: \bVerbalExpression.Builder.wordChar()Add word character, same as [a-zA-Z_0-9]VerbalExpression.Builder.zeroOrMore()Adds "*" char to regexp, means zero or more times repeated Same effect asVerbalExpression.Builder.atLeast(int)with "0" argumentMethods in ru.lanwen.verbalregex with parameters of type VerbalExpression.BuilderModifier and TypeMethodDescriptionVerbalExpression.Builder.add(VerbalExpression.Builder regex) Append a regex from builder and wrap it with unnamed group (?VerbalExpression.Builder.maybe(VerbalExpression.Builder regex) Add a regex to the expression that might appear once (or not) Example: The following matches all names that have a prefix or not.static VerbalExpression.BuilderVerbalExpression.regex(VerbalExpression.Builder pBuilder) Creates new instance of VerbalExpression builder from cloned builder