public class RegexHelper extends Object
| Constructor and Description |
|---|
RegexHelper() |
| Modifier and Type | Method and Description |
|---|---|
String |
createRegexForUrl(String url)
Quotes the url and adds a
^ and $. |
String |
createRegexForUrlTemplate(String url,
String placeholder)
Replaces all placeholders in a "url template" with
.*?, quotes everything else and adds ^ and
$ to it. |
public String createRegexForUrlTemplate(String url, String placeholder)
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.*?$
Copyright © 2012–2021 Graylog, Inc.. All rights reserved.