Not sure how to answer or do this question.. Q1. What regular expression would y
ID: 3588276 • Letter: N
Question
Not sure how to answer or do this question..
Q1. What regular expression would you use to find a credit card number? Write the regular expression below and at least two examples of a credit card number that your regular expression can match.
So for an example I have made a fake number , how do I write the regular expression?
4440 9987 9923 7783
4440-9987-9923-7783
Q2.What regular expression would you use to find a URL? Write the regular expression below and at least two examples of an URL that your regular expression can match.
www.google.com
http://www.nytimes.com
What would be the expression? Please help. Thanks
Explanation / Answer
Q1) Regular expression would you use to find a credit card number:
^4[0-9]{12}(?:[0-9]{3})?$.
This regular expression represents credit card number that start with 4 and contains 16 digits.
Q2)Regular expression would you use to find a URL
(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|$!:,.;]*
[A-Z0-9+&@#/%=~_|$]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.