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

feat: support custom regexp #126

Closed
wants to merge 1 commit into from
Closed

feat: support custom regexp #126

wants to merge 1 commit into from

Conversation

Anonym-tsk
Copy link
Contributor

Support custom regexp parsing using options: { regexp: /regexString/ }

@eddiemonge
Copy link
Collaborator

thought I already merged this for some reason. Need to do some testing to make sure it works before though.

@eddiemonge
Copy link
Collaborator

Needs a rebase on top of the semver update.

@Anonym-tsk
Copy link
Contributor Author

Done

@eddiemonge
Copy link
Collaborator

gut feeling says the option should be options.regExp.

@schechter can you confirm the escaping on the regex is good?

@schechter
Copy link
Contributor

Yes, I've tested the new RegExp with all bumping options and it is working as expected.

Additionally, the [\\d||A-a|.|-]* portion can also be removed and all bumping options still work (with and without a prereleaseName) if you want to take this opportunity to shorten the RegExp.
i.e.:var VERSION_REGEXP = opts.regexp || new RegExp('([\'|\"]?version[\'|\"]?[ ]*:[ ]*[\'|\"]?)(\\d+\\.\\d+\\.\\d+(-' + opts.prereleaseName + '\\.\\d+)?(-\\d+)?)([\'|\"]?)', 'i');

@eddiemonge
Copy link
Collaborator

that would make a nice pr

@schechter
Copy link
Contributor

Will look into that one more 1st (actually I'd like to add some tests around that before make more changes to the RegExp. (I think it would need to take into account the possible differences if the option for git describe are changed.)

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

Successfully merging this pull request may close these issues.

3 participants