Javascript regex to detected possible credit card numbers -


I have no end to trouble with a set of regex or regex.

Finds what I want to do:

  • Find the narrow run of the length 13 through 19
  • Length 13 to 19 Find points of interspersed points interspersed with the lower position
  • Li>
  • Find the difference points with a dash of 13 to 19

Basic business The need to warn a user that they may have entered a credit card number in a text field and they do not (Although only a warning, not a difficult error) Text field can span several lines, can be up to 8k, a CC # can be embedded anywhere (unlike many lines ), Can be more than 1 cc # (though prescence I need at least 1. I do not need a real value). There is no need to validate the check digit.

Length can be examined externally ... that is, I am happy with the loop through the set of matches, leave any whites / dashes and then compare the length.

But ... javascript regex is defeating every effort (not just right "head space"), so I thought I would ask here :)

Thank you!

These are all. You should be able to easily do it in javascript.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -