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

reactStringReplace is returning a blank string for match #7

Closed
JacobTheEvans opened this issue Sep 29, 2016 · 2 comments
Closed

reactStringReplace is returning a blank string for match #7

JacobTheEvans opened this issue Sep 29, 2016 · 2 comments
Labels

Comments

@JacobTheEvans
Copy link

JacobTheEvans commented Sep 29, 2016

I am having an issue below that when I run the code below a match is found but an empty string is returned for the match.

//code

let newStr = reactStringReplace(str, /\[img.*?]/g, (match, i) => (
  <img key={"processed: " + match + i} src={match.replace('[img src="', " ").replace('"]', "")} />
));

//input

[img src="http://i.imgur.com/GBpbHPh.png"]

Any advice?

@iansinnott iansinnott added the bug label Sep 29, 2016
@iansinnott
Copy link
Owner

Hm, that's odd. Definitely sounds like a bug. I'd love to add a test for this to keep it from happening again. I'm not sure off hand what the issue might be but I'm happy to help out. Could you create a repo where I can reproduce this?

@JacobTheEvans
Copy link
Author

After more experimenting, I realized it was an issue with my regex pattern. So I will close this issues sorry about that.

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

2 participants