-
Notifications
You must be signed in to change notification settings - Fork 146
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
Add option for case sensitive inputs #246
Conversation
I narrowed this down and found out that I had called
which means something different from what I intended
|
Can you add some unit tests for this? |
Done |
I was hoping for a test that the non-wildcard parts of triggers still match correctly too. 😄 I checked out your branch to do some poking at it myself. It has a problem matching this trigger:
Output:
The regexps that match triggers should use the case insensitive flag. Around here is one place to update, and the %previous code might need to update too. |
I guess that's the expected behavior. My goal wasn't to make the matchers case insensitive. It is to make the inputs case sensitive so if you have a
|
As an update on this @kirsle I actually added the insensitive flag to those lines and a test for |
Negative. I didn't compile when I tested. It should be all good now. Also, I'm sorry I was after my own selfish need initially. Thought this through and saw why you requested it |
I have a specific circumstance where I need to ask the user to copy / paste an ID, which I'll then use to look up some info for them. The ID is unfortunately case sensitive. Since this change is a global thing, it wouldn't help. I'm wondering if there can be an option in the reply methods or something for specifying this, or perhaps a way to make a single topic case sensitive? (I'm very new to this thing so apologies if this is a stupid question, but this scenario is a real world one and I'm thinking others would be likely to come across it as well). |
@kirsle I don't know if you've seen this yet. What do you think? I wonder why it's not been considered for merge. @KAKwit in the mean time, you could use rivescript-promises. With that you can make your user inputs case sensitive by passing it as a parameter to the Rivescript instance: new Rivescript({ utf8: true, caseSensitive: true }) |
The upstream code has changed quite a bit now (moving from CoffeeScript back to vanilla JS); mind rebasing this PR on the latest master? |
Case-sensitive user inputs (#246)
Hey guys, better late than never, I ported this PR onto the modern JavaScript base of rivescript-js and merged it in #378. RiveScript.js v2.2.0 adds the |
new Rivescript({ caseSensitive: true }) would return inputs
without calling toLowerCase() on them. Fixes #245