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

function to skip the node #3

Closed
ajopjo opened this issue May 26, 2020 · 4 comments
Closed

function to skip the node #3

ajopjo opened this issue May 26, 2020 · 4 comments

Comments

@ajopjo
Copy link

ajopjo commented May 26, 2020

Hi:

I'm looking at the package to do a reg ex search for the validity of a string.

I have a requirement in which a user enter a "" to skip some of the nodes in the search.
As an example if my regex is 536X[5|8][A-Z]+ a user enters 5
5A.
So, is there any way I can search a character in the FSM node and if its not matching move to the next node and search. Help on this will be highly appreciated

@nurulc
Copy link
Owner

nurulc commented May 27, 2020 via email

@nurulc
Copy link
Owner

nurulc commented May 27, 2020

var iRX = require('incr-regex-package');
var { RXInputMask } = iRX;
// little helper function
function ins(rxi, str) { for(var i=0; i<str.length; i++) { rxi.input(str.charAt(i)); } return rxi; }
var im = new RXInputMask({pattern: "536X[5|8][A-Z]+"});
ins(im,"55A");
assert(im.isDone() === 'OK');
assert(im._getValue() === '536X5A');

@ajopjo
Copy link
Author

ajopjo commented May 28, 2020

Thank you @nurulc . have you incorporated apis to generate valid values from a regular expression, i saw that comment as part of the road map. Thanks!!

@nurulc nurulc closed this as completed May 29, 2020
@nurulc
Copy link
Owner

nurulc commented May 29, 2020

The capability is a part of the package

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