반응형 Regular Expression2 Python regular expression match and search methods Long story short, match and search methods can be used whether to search the beginning of the string or the entire string. Let's dig into an example. import re data = ["ESA1-XXX-XXX - Po1", "ESA1-XXX-XXX - PO1"] for elem in data: m = re.search('(Po|PO)\d', elem).group() What I want to do is to find and replace "- Po1" or "- PO1" to "(Po1)" or "(PO1)". In order to find a certain pattern, I use re.. 2020. 3. 24. Regular expression practice Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note: For the purpose of this problem, we define empty string as valid palindrome.Example 1:Input: "A man, a plan, a canal: Panama" Output: true Example 2:Input: "race a car" Output: false I know the concept of regular expression, however, I barely use this concept when I develop. I think.. 2019. 1. 17. 이전 1 다음 반응형