Skip to content

RegExp support #1188

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

Closed
mpmartins opened this issue Mar 25, 2020 · 6 comments
Closed

RegExp support #1188

mpmartins opened this issue Mar 25, 2020 · 6 comments
Labels

Comments

@mpmartins
Copy link

mpmartins commented Mar 25, 2020

Hello,

I've been playing around with AssemblyScript and I noticed it still doesn't have RegExp object implemented: https://github.com/AssemblyScript/assemblyscript/blob/master/std/assembly/regexp.ts

I am able to compile the following code:
const regex : RegExp = new RegExp('hi');//return true; return regex.test('hi, i am peter');
But not able to execute it:

/Users/m0m02y0/as/assembly/node_modules/@assemblyscript/loader/index.js:72
throw Error("abort: " + getString(memory, mesg) + " at " + getString(memory, file) + ":" + line + ":" + colm);
^

Error: abort: unreachable at ~lib/regexp.ts:4:53
at abort (/Users/m0m02y0/as/assembly/node_modules/@assemblyscript/loader/index.js:72:11)
at ~lib/regexp/RegExp#constructor (wasm-function[15]:0xb3b)
at assembly/index/test1 (wasm-function[17]:0xb6d)
at Object.curr. [as test1] (/Users/m0m02y0/as/assembly/node_modules/@assemblyscript/loader/index.js:407:18)
at Object. (/Users/m0m02y0/as/assembly/tests/index.js:4:23)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
npm ERR! Test failed. See above for more details.

Is this in your roadmap? Is there another way to use regular expressions in AS?

Thank you

@dcodeIO
Copy link
Member

dcodeIO commented Mar 25, 2020

RegExp isn't implemented yet. Plan is to derive something from a battle-tested C library eventually, but until then all one can do is to call out to JS or use a different mechanism, like string methods, if that's an option.

@mpmartins
Copy link
Author

Thanks Daniel for the quick reply.
This is probably a dealbreaker for our team since we are exploring languages to write Envoy WASM Filters. I will circle back with the team to hear what they think.
By any chance, do you guys already have this in your roadmap?

@MaxGraey
Copy link
Member

By any chance, do you guys already have this in your roadmap?

Not a high priority in roadmap at the moment.

@mpmartins
Copy link
Author

Ok, thanks for the quick response guys. I spoke to my team and this is a showstopper for us.
Either way, the whole idea of AssemblyScript is awesome and I'm eager to see it when it's ready and fully functional.

@piersdeseilligny
Copy link

piersdeseilligny commented Nov 18, 2020

Should this issue really be closed? It seems like a fairly big missing feature of assemblyscript :/

@ColinEberhardt
Copy link
Contributor

You can find a pretty feature-complete Regex library for AssemblyScript here https://github.com/ColinEberhardt/assemblyscript-regex

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

No branches or pull requests

5 participants