Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String has no match #1

Open
adamwong246 opened this issue Nov 17, 2022 · 1 comment
Open

String has no match #1

adamwong246 opened this issue Nov 17, 2022 · 1 comment

Comments

@adamwong246
Copy link

Perhaps I'm confused but without this method, does derw have the capacity to match regular expressions?

@eeue56
Copy link
Contributor

eeue56 commented Nov 18, 2022

Hi!

So, basically you can use methods on objects in Derw as you would in TypeScript. This means you can use something like:

aString: string
aString = 
    ""
 
someTest: boolean
someTest =
    let 
        match: any 
        match =
            aString.match "[a-z]*"
    in
        match == null

or do whatever you want with the match array.

If you were going to using it more often though, the way would be to create a kernel code wrapper around the regex functions to make it more like Derw (for example - not using nulls and return a Maybe instead). For more examples of kernel code, check out this repo - and the GitBook, where everything has examples of what code gets compiled to. Pull requests welcome!

Feel free to reach out to me on Twitter or Zulip if you have any other questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants