github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/lists/regexp_doc.yaml (about) 1 - DocumentID: match 2 Title: >+ 3 `match` 4 CategoryID: commands 5 Summary: >- 6 Match an exact value in an array 7 Description: |- 8 `match` takes input from STDIN and returns any array items / lines which 9 contain an exact match of the parameters supplied. 10 11 When multiple parameters are supplied they are concatenated into the search 12 string and white space delimited. eg all three of the below are the same: 13 14 ``` 15 match "a b c" 16 match a\sb\sc 17 match a b c 18 match a b c 19 ``` 20 21 If you want to return everything except the search string then use `!match` 22 Usage: |- 23 Match every occurrence of search string 24 25 ``` 26 <stdin> -> match search string -> <stdout> 27 ``` 28 29 Match everything except search string 30 31 ``` 32 <stdin> -> !match search string -> <stdout> 33 ``` 34 Examples: |- 35 Match **Wed** 36 37 ``` 38 » ja [Monday..Friday] -> match Wed 39 [ 40 "Wednesday" 41 ] 42 ``` 43 44 Match everything except **Wed** 45 46 ``` 47 » ja [Monday..Friday] -> !match Wed 48 [ 49 "Monday", 50 "Tuesday", 51 "Thursday", 52 "Friday" 53 ] 54 ``` 55 Flags: 56 Detail: |- 57 `match` is data-type aware so will work against lists or arrays of whichever 58 Murex data-type is passed to it via STDIN and return the output in the 59 same data-type. 60 Synonyms: 61 - match 62 - "!match" 63 - list.string 64 Related: 65 - a 66 - ja 67 - ta 68 - count 69 - 2darray 70 - append 71 - prepend 72 - suffix 73 - prefix 74 - jsplit 75 - msort 76 - pretty 77 - map 78 - regexp 79 80 - DocumentID: regexp 81 Title: >+ 82 `regexp` 83 CategoryID: commands 84 Summary: >- 85 Regexp tools for arrays / lists of strings 86 Description: |- 87 `regexp` provides a few tools for text matching and manipulation against an 88 array or list of strings - thus `regexp` is Murex data-type aware. 89 Usage: |- 90 ``` 91 <stdin> -> regexp expression -> <stdout> 92 ``` 93 Examples: |- 94 ### Find elements 95 96 ``` 97 » ja [monday..sunday] -> regexp 'f/^([a-z]{3})day/' 98 [ 99 "mon", 100 "fri", 101 "sun" 102 ] 103 ``` 104 105 This returns only 3 days because only 3 days match the expression (where 106 the days have to be 6 characters long) and then it only returns the first 3 107 characters because those are inside the parenthesis. 108 109 ### Match elements 110 111 Elements containing 112 113 ``` 114 » ja [monday..sunday] -> regexp 'm/(mon|fri|sun)day/' 115 [ 116 "monday", 117 "friday", 118 "sunday" 119 ] 120 ``` 121 122 Elements excluding 123 124 ``` 125 » ja [monday..sunday] -> !regexp 'm/(mon|fri|sun)day/' 126 [ 127 "tuesday", 128 "wednesday", 129 "thursday", 130 "saturday" 131 ] 132 ``` 133 134 ### Substitute expression 135 136 ``` 137 » ja [monday..sunday] -> regexp 's/day/night/' 138 [ 139 "monnight", 140 "tuesnight", 141 "wednesnight", 142 "thursnight", 143 "frinight", 144 "saturnight", 145 "sunnight" 146 ] 147 ``` 148 Flags: 149 f: output found expressions 150 (doesn't support bang prefix) 151 m: output elements that match expression 152 (supports bang prefix) 153 s: output all elements - substituting elements that match expression 154 (doesn't support bang prefix) 155 Detail: |- 156 `regexp` is data-type aware so will work against lists or arrays of whichever 157 Murex data-type is passed to it via STDIN and return the output in the 158 same data-type. 159 Synonyms: 160 - regexp 161 - "!regexp" 162 - list.regex 163 Related: 164 - a 165 - ja 166 - ta 167 - count 168 - 2darray 169 - append 170 - prepend 171 - suffix 172 - prefix 173 - jsplit 174 - msort 175 - pretty 176 - map 177 - match