buzz icon indicating copy to clipboard operation
buzz copied to clipboard

string lib: pattern matching (pcre regex)

Open giann opened this issue 3 years ago • 1 comments

  • [X] Pattern new type: pat pattern = _^hello$_;
  • [ ] Allow pattern initialization with a string pat pattern = "^with a string$";

pat methods are:

  • [X] pattern.match(str subject) > [str]: Returns the first match and eventual captures
  • [X] pattern.matchAll(str subject) > [[str]]: Returns all matches and captures
  • [x] pattern.replace(str subject, str replacement) > str: Replaces first match with replacement
  • [x] pattern.replaceAll(str subject, str replacement) > str: Replaces all matches with replacement
  • [ ] handle named capture

str methods:

  • [ ] string.match(pat pattern) > [str]: same as pattern.match
  • [ ] string.matchAll(pat pattern) > [str]: same as pattern.matchAll
  • [ ] string.replace(pat pattern) > [str]: same as pattern.replace
  • [ ] string.replaceAll(pat pattern) > [str]: same as pattern.replaceAll
  • [ ] When #54 is done, string.match and pattern.match should return iterators.

giann avatar Mar 18 '22 15:03 giann

Use pomsky? https://github.com/rulex-rs/pomsky

giann avatar Dec 30 '22 16:12 giann