Package org.graylog2.system.urlwhitelist
Class RegexHelper
java.lang.Object
org.graylog2.system.urlwhitelist.RegexHelper
Utility class to help creating an appropriate regex to be used in a whitelist entry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateRegexForUrl(String url) Quotes the url and adds a^and$.createRegexForUrlTemplate(String url, String placeholder) Replaces all placeholders in a "url template" with.*?, quotes everything else and adds^and$to it.
-
Constructor Details
-
RegexHelper
public RegexHelper()
-
-
Method Details
-
createRegexForUrlTemplate
Replaces all placeholders in a "url template" with
.*?, quotes everything else and adds^and$to it.An example:
https://example.com/api/lookup?key=${key}will become^\Qhttps://example.com/api/lookup?key=\E.*?$
-
createRegexForUrl
Quotes the url and adds a^and$.
-