Skip to content

Custom regex #63

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

Closed
IonicaBizau opened this issue Jul 27, 2015 · 4 comments
Closed

Custom regex #63

IonicaBizau opened this issue Jul 27, 2015 · 4 comments

Comments

@IonicaBizau
Copy link

It would be super nice to allow a custom regex for splitting the words, for example. I need that in one of my projects.

This could be useful when I want to consider words containing special characters (like . or so).

@kpdecker
Copy link
Owner

You can do this with a custom override. Take a look at how all of the existing diffs are implemented:

  var CssDiff = new Diff(true);
  CssDiff.tokenize = function(value) {
    return removeEmpty(value.split(/([{}:;,]|\s+)/));
  };

@IonicaBizau
Copy link
Author

I know, but how can I call the local removeEmpty function, outside of the module?

Thanks!

@kpdecker
Copy link
Owner

kpdecker commented Aug 1, 2015

Right now you'd need to copy that into your own code. We don't expose that anywhere right now but #64 should make this a bit easier to use once implemented.

@kpdecker kpdecker closed this as completed Aug 1, 2015
@IonicaBizau
Copy link
Author

@kpdecker Okok, thanks!

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

No branches or pull requests

2 participants