Package de.xima.fc.form.renderer
Class JsRegExpCheck
java.lang.Object
de.xima.fc.form.renderer.JsRegExpCheck
Checks whether a string matches a JavaScript regexp. Adds protection against malicious regexps that may cause
infinite loops.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
ConstructorsConstructorDescriptionJsRegExpCheck(Object[] args) Creates a new regexp check with the given regexp and flags.JsRegExpCheck(String regExp, String... flags) -
Method Summary
Modifier and TypeMethodDescriptionbooleanwithTimeout(long timeout, TimeUnit unit) Changes the default timeout.
-
Constructor Details
-
JsRegExpCheck
Creates a new regexp check with the given regexp and flags.- Parameters:
args- An array that contains the regexp (String) as the first item, and optional String flags as the second, third, etc. item. Currently onlyi,g, andmflags are supported by the regexp engine.
-
JsRegExpCheck
- Parameters:
regExp- Regexp to use.flags- Optional flags for the regexp. Currently onlyi,g, andmflags are supported by the regexp engine.
-
-
Method Details
-
test
-
withTimeout
Changes the default timeout. When the regexp check takes longer than this timeout, the check is aborted and the regexp is considered not to match the input.- Parameters:
timeout- Timeout for the regexp check.unit- Unit of the given timeout value.- Returns:
- A new regexp check with the given timeout.
-