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

Regex support #12

Open
fregante opened this issue Jan 3, 2021 · 2 comments
Open

Regex support #12

fregante opened this issue Jan 3, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@fregante
Copy link
Contributor

fregante commented Jan 3, 2021

Thoughts on regex support? indexOf would have to be replaced with search

const splitOnFirst = require('split-on-first');

splitOnFirst('a,b,c', /[.,]/);
//=> ['a', 'b,c']
@sindresorhus
Copy link
Owner

Sure. Sounds useful.

How would it behave when the regex has a /g flag? I assume, just ignore it.

@sindresorhus sindresorhus added enhancement New feature or request help wanted Extra attention is needed labels Jan 4, 2021
@fregante
Copy link
Contributor Author

fregante commented Jan 4, 2021

I think that's automatically ignored:

Screen Shot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants