We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Regex
- Applications
- Detect HTML Tags
- Discussions
Detect HTML Tags
Detect HTML Tags
Sort by
recency
|
151 Discussions
|
Please Login in order to post a comment
For Python 3:
import re T = int(input())
pattern = r'\<([A-Za-z0-9]{1,})|\<\s+([A-Za-z0-9]{1,})' tag_set = set()
while T>0: line = input() pattern_found = re.findall(pattern, line) for p in pattern_found: tag_set.add(p[0]) tag_set.add(p[1]) T-=1
print(";".join(sorted([tag for tag in tag_set if len(tag) > 0 ])))
Python:
import re; html = "\n".join([input() for _ in range(int(input()))]); print(";".join(sorted(set(re.findall(r"<\s?([a-zA-Z]+[0-9A-Za-z])[^>]>", html)))));
Perl