I had a question, how do I detect sensitive information in data from a canvas app? One approach: look for it during data entry. Lets make this reusable!
To illustrate this, I created a custom component:
I added the output property like this:
Then I added a parameter named content to the property:
I selected the property and added this formula to it:
IsMatch(Substitute(Trim(Content), " ", ""), "(4[0-9]{12}(?:[0-9]{3})?)|((?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|(6(?:011|5[0-9]{2})[0-9]{12})|((?:2131|1800|35\d{3})\d{11})")
This regular expression is just an example, not a tried and true way to detect credit cards. Please test, test, test before you trust anything you find on the internet!!
Now I add the custom component to the screen along with a text input and label. I renamed my component object to "Security".
In the text value of the label, I used this formula:
Security.ContainsCreditCard(TextInput1.Text)
Now I run the app and add some text. It should show false until I add something that resembles a credit card:
This example shows how to build reusable functions that can do things to help make applications more robust.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.