프로그래밍/python
따옴표 안의 문자열을 추출하는 정규식
이휘재123
2022. 10. 7. 11:13
반응형
# 작은 따옴표 안의 문자
re.findall("'([^']*)'", your_string)
# 큰 따옴표 안의 문자
re.findall('"([^"]*)"', your_string)
사용 사례
js = javascript:goDelvTrack('111111','한진택배','222222222222','https://www.hanjin.co.kr/kor/CMS/DeliveryMgr/WaybillResult.do?mCode=MN038&schLang=KR&wblnumText2=222222222222','33333333333333')
js_splits = re.findall("'([^']*)'", js)
print(js_splits)
# 결과
['111111', '한진택배', '222222222222', 'https://www.hanjin.co.kr/kor/CMS/DeliveryMgr/WaybillResult.do?mCode=MN038&schLang=KR&wblnumText2=222222222222', '33333333333333']
반응형