1[[bbv2.reference.modules.regex]] 2= regex 3 4Contains rules for string processing using regular expressions. 5 6* `"x*"` matches the pattern `"x"` zero or more times. 7* `"x+"` matches `"x"` one or more times. 8* `"x?"` matches `"x"` zero or one time. 9* `"[abcd]"` matches any of the characters, `"a"`, `"b"`, `"c"`, and 10`"d"`. A character range such as `"[a-z]"` matches any character between 11`"a"` and `"z"`. `"[^abc]"` matches any character which is not `"a"`, 12`"b"`, or `"c"`. 13* `"x|y"` matches either pattern `"x"` or pattern `"y"` 14* `(x)` matches `"x"` and captures it. 15* `"^"` matches the beginning of the string. 16* `"$"` matches the end of the string. 17* "\<" matches the beginning of a word. 18* "\>" matches the end of a word. 19 201. [[bbv2.reference.modules.regex.split]] `rule split ( string separator )` 21+ 22Returns a list of the following substrings: 23+ 24.. from beginning till the first occurrence of `separator` or till the 25end, 26.. between each occurrence of `separator` and the next occurrence, 27.. from the last occurrence of `separator` till the end. 28+ 29If no separator is present, the result will contain only one element. 30 312. [[bbv2.reference.modules.regex.split-list]] `rule split-list ( list * : separator )` 32+ 33Returns the concatenated results of applying 34link:#bbv2.reference.modules.regex.split[regex.split] to every element 35of the list using the separator pattern. 36 373. [[bbv2.reference.modules.regex.match]] `rule match ( pattern : string : indices * )` 38+ 39Match `string` against `pattern`, and return the elements indicated by 40`indices`. 41 424. [[bbv2.reference.modules.regex.transform]] `rule transform ( list * : pattern : indices * )` 43+ 44Matches all elements of `list` against the `pattern` and returns a list 45of elements indicated by `indices` of all successful matches. If 46`indices` is omitted returns a list of first parenthesized groups of all 47successful matches. 48 495. [[bbv2.reference.modules.regex.escape]] `rule escape ( string : symbols : escape-symbol )` 50+ 51Escapes all of the characters in `symbols` using the escape symbol 52`escape-symbol` for the given string, and returns the escaped string. 53 546. [[bbv2.reference.modules.regex.replace]] `rule replace ( string match replacement )` 55+ 56Replaces occurrences of a match string in a given string and returns the 57new string. The match string can be a regex expression. 58 597. [[bbv2.reference.modules.regex.replace-list]] `rule replace-list ( list * : match : replacement )` 60+ 61Replaces occurrences of a match string in a given list of strings and 62returns a list of new strings. The match string can be a regex 63expression. 64 65See also: link:#jam.language.rules.builtins.utility.\_match__[MATCH] 66