Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /w+@(tickets.)?company.com/i
- findall(pattern, string, flags=0)
- Return a list of all non-overlapping matches in the string.
- If one or more groups are present in the pattern, return a
- list of groups; this will be a list of tuples if the pattern
- has more than one group.
- Empty matches are included in the result.
- r'(w+@(tickets.)?company.com)'
- r'w+@(?:tickets.)?company.com'
- '(w+@(?:tickets.)?company.com)'
- r'w+@(tickets.)?company.com'
- >>> import re
- >>> exp = re.compile(r'w+@(tickets.)?company.com')
- >>> bool(exp.match("s@company.com"))
- True
- >>> bool(exp.match("1234567@tickets.company.com"))
- True
- #!/usr/bin/python
- import re
- regex = re.compile("(w+@(?:tickets.)?company.com)");
- a = [
- "foo@company.com",
- "foo@tickets.company.com",
- "foo@ticketsacompany.com",
- "foo@compant.org"
- ];
- for string in a:
- print regex.findall(string)
Add Comment
Please, Sign In to add comment