6

I'm trying to find a component or a method which will detect credit card number of varying types in text.

I've found a lot of information on validating a credit card number but I need to be able to take a body of text e.g. a web page and check to see if credit card numbers, bank account numbers and or sort codes are present.

Does anyone know of a component that can help commerical or otherwise? Specifically my platform is .net c# but if anyone knows of solutions in other technologies it would be good to know those are there.

Thanks for your help.

2 Answers2

5

This demands for a regular expression :)

Check this page http://www.regular-expressions.info/creditcard.html, especially the part "Finding Credit Card Numbers in Documents". (Though you'll probably find some false positives if looking for 16-digit-numbers.)

Select0r
  • 12,234
  • 11
  • 45
  • 68
  • I imagine there are a few other rules to CC number detection than just "it's a 16-digit or 4x 4 digit number" but it's a start – geocoin Feb 05 '10 at 10:24
  • Regular expression would certainly do the trick and that's a good reference, but your point about 16 digit number is right in that I don't know all of the formats for card numbers which is why I'm interested in a component supported by someone that does know. – Richard Churchill Feb 16 '10 at 17:06
0

Because credit card numbers have a fixed format, a simple regular would suffice.

Ondergetekende
  • 1,065
  • 9
  • 22