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.search(regexp) #117

Closed
jasonwilliams opened this issue Sep 27, 2019 · 12 comments
Closed

String.search(regexp) #117

jasonwilliams opened this issue Sep 27, 2019 · 12 comments
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Milestone

Comments

@jasonwilliams
Copy link
Member

jasonwilliams commented Sep 27, 2019

search function would need to be added to the string object here:
https://github.com/jasonwilliams/boa/blob/master/src/lib/js/string.rs

It would be very similar to:
https://github.com/jasonwilliams/boa/blob/master/src/lib/js/regexp.rs#L212-L251

Spec:
https://tc39.es/ecma262/#sec-string.prototype.search

Debugging:
https://github.com/jasonwilliams/boa/blob/master/docs/debugging.md

@jasonwilliams jasonwilliams added enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com labels Sep 27, 2019
@jasonwilliams jasonwilliams added this to the Regex milestone Sep 27, 2019
@CalliEve
Copy link
Contributor

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

@jasonwilliams
Copy link
Member Author

@Baev1 sure ive assigned to you

@CalliEve
Copy link
Contributor

CalliEve commented Oct 2, 2019

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?

@muskuloes
Copy link
Contributor

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(...))?

@bojan88
Copy link
Contributor

bojan88 commented Oct 6, 2019

Hey guys, I used a little bit different approach. Please have a look at jasonwilliams#138.

@muskuloes
Copy link
Contributor

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.

@jasonwilliams
Copy link
Member Author

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

@jasonwilliams
Copy link
Member Author

jasonwilliams commented Oct 7, 2019

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

@Rana6060
Copy link

مكررة مكررة من #

@klolev
Copy link

klolev commented Oct 5, 2020

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

@RageKnify
Copy link
Member

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

@raskad
Copy link
Member

raskad commented Aug 28, 2021

This was fixed in #1314

@raskad raskad closed this as completed Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants