Python 정규표현식

1 개요[ | ]

Python 정규표현식

2 findall[ | ]

import re

text = "hello 1122 : reference hello, hello 1033: argument hello"
regex = re.compile("hello")
mo = regex.findall(text)
if mo != None:
    print( mo )
    # ['hello', 'hello', 'hello', 'hello']

3 search[ | ]

import re

text = "hello 1122 : reference hello, hello 1033: argument hello"
regex = re.compile("hello")
mo = regex.search(text)
if mo != None:
    print( mo )
    # <_sre.SRE_Match object; span=(0, 5), match='hello'>
    print( mo.group() )
    # hello

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}