From 2c04a562362d3046247417aa6695f747a94178e4 Mon Sep 17 00:00:00 2001 From: James Lagermann Date: Fri, 8 May 2020 12:31:56 -0500 Subject: [PATCH] added examples to set_to_regex comments Signed-ff-by: James Lagermann --- scripts/base/utils/patterns.zeek | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/base/utils/patterns.zeek b/scripts/base/utils/patterns.zeek index fc2ee6ba61..5f51aedd91 100644 --- a/scripts/base/utils/patterns.zeek +++ b/scripts/base/utils/patterns.zeek @@ -13,6 +13,13 @@ module GLOBAL; ## string parsing reducing it to a single backslash upon rendering. ## ## Returns: the input pattern with "~~" replaced by OR'd elements of input set. +## +## Examples: +## global r1 = set_to_regex(set("a", "b", "c"), "~~"); +## results: r1 = /^?(a|b|c)$?/ +## +## global r2 = set_to_regex(set("a.com", "b.com", "c.com"), "\\.(~~)"); +## results: r2 = /^?(\.(a\.com|b\.com|c\.com))$?/ function set_to_regex(ss: set[string], pat: string): pattern { local i: count = 0;