I want to write a regex for the following:
Pattern1:
mailto:abc@gmail.com
The regex1 should match all the strings that start with mailto:
Pattern2:
mailto:abc@gmail.com?subject=Indian&body=hello
The regex2 should extract the query string (string after ?)
No need for regular expressions. Simply match any string where the first seven characters are “mailto:”.
If you insist on using regular expressions, the expression would be “mailto:.*”. If you only want to keep what is after the “mailto:”, it would be “mailto:(.*)”