Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathieuprog/regex_to_strings
Get the strings a regex will match
https://github.com/mathieuprog/regex_to_strings
Last synced: about 2 months ago
JSON representation
Get the strings a regex will match
- Host: GitHub
- URL: https://github.com/mathieuprog/regex_to_strings
- Owner: mathieuprog
- License: apache-2.0
- Created: 2021-05-09T15:12:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-10T09:30:52.000Z (over 3 years ago)
- Last Synced: 2024-09-20T01:18:22.063Z (4 months ago)
- Language: Elixir
- Size: 21.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Regex to strings
Get the strings a regex will match.
## Examples
```elixir
import RegexToStringsregex_to_strings("11|2[25]2") == {:ok, ["11", "222", "252"]}
regex_to_strings!("8(024|53)9") == ["80249", "8539"]
regex_to_strings!("(16|7?[56])24") == ["1624", "524", "7524", "624", "7624"]
regex_to_strings!("1[03-59]") == ["10", "13", "14", "15", "19"]
regex_to_strings("1.+2") == :unsupported_regex
regex_to_strings!("1.+2") # RuntimeError: unsupported metacharacter "."
```## Installation
Add `regex_to_strings` for Elixir as a dependency in your `mix.exs` file:
```elixir
def deps do
[
{:regex_to_strings, "~> 0.5.0"}
]
end
```## HexDocs
HexDocs documentation can be found at [https://hexdocs.pm/regex_to_strings](https://hexdocs.pm/regex_to_strings).