Boa: String.search(regexp)

Created on 27 Sep 2019  路  12Comments  路  Source: boa-dev/boa

enhancement good first issue Hacktoberfest

Most helpful comment

not had chance to look at this yet, but will do

All 12 comments

Hi! I would like to work on this if that's alright?
seems like a nice exercise in rust outside of my personal projects 馃槃

@Baev1 sure ive assigned to you

Thank you @jasonwilliams!
I have looked into it a bit already and to me the ways to do it seem to check if the provided arg is a RegExp and else call make_regexp and then call the exec function from regexp as the RegExp struct itself is private and thus the approach taken in the exec function itself is impossible.
Would this be a good strategy or could I get permission to make the RegExp struct public or am I totally thinking the wrong way?

Hi, I am learning rust and I work on string.match(regexp) #114 , and it seems as we need a function that extracts a regexp literal in string.rs. Like here: https://github.com/jasonwilliams/boa/blob/5df34762e64558c9c1042219ce1baee05777bf1d/src/lib/js/regexp.rs#L55-L73

I included those lines directly in my match implementation #131. Having it as a separate private function would help us both and also #115 , if using the RegExp struct is not allowed.

A question of my own would be, how can we support: string.match(new RegExp(...))?

Hey guys, I used a little bit different approach. Please have a look at https://github.com/jasonwilliams/boa/pull/138.

Yeah, We need a common way to extract regex's. Your PR also in a way answers my question. But I am not sure about implementing the actual functionality in regexp.rs, even though it allows us to use the RegExp struct comfortably. If that'd be the case, I'll update my PR.

not had chance to look at this yet, but will do

Thank you @jasonwilliams!
I have looked into it a bit already and to me the ways to do it seem to check if the provided arg is a RegExp and else call make_regexp and then call the exec function from regexp as the RegExp struct itself is private and thus the approach taken in the exec function itself is impossible.
Would this be a good strategy or could I get permission to make the RegExp struct public or am I totally thinking the wrong way?

Hey @Baev1 im trying to follow, what do you mean the RegEp struct itself is private and this its impossible? I think it should be possible to use exec here.

If the arg being passed in is already a RegExp, then you could just use ctx to call exec on it

賲賰乇乇丞 賲賰乇乇丞 賲賳 #

Hey, I'd like to pick this issue up if it's still valid!

I'll be removing the assignment, if @flix477 still wants to finish their PR we can give back the assignment.

This was fixed in #1314

Was this page helpful?
0 / 5 - 0 ratings