| 1 | module main |
| 2 | |
| 3 | import regex { RE, regex_opt } |
| 4 | |
| 5 | pub struct EmptyRegex { |
| 6 | } |
| 7 | |
| 8 | type OurRegex = EmptyRegex | RE |
| 9 | |
| 10 | pub struct ListArgs { |
| 11 | pub mut: |
| 12 | regex OurRegex |
| 13 | } |
| 14 | |
| 15 | fn main() { |
| 16 | query := r'(c(pa)+z ?)+' |
| 17 | mut re := regex_opt(query) or { panic(err) } |
| 18 | |
| 19 | item := 'sss' |
| 20 | mut la := ListArgs{ |
| 21 | regex: re |
| 22 | } |
| 23 | |
| 24 | mut r := la.regex |
| 25 | if r is RE { |
| 26 | println(r) |
| 27 | println(r.matches_string(item)) |
| 28 | } |
| 29 | |
| 30 | match r { |
| 31 | RE { r.matches_string(item) } |
| 32 | else {} |
| 33 | } |
| 34 | } |
| 35 |