일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- google apps script
- Excel
- PySpark
- PostgreSQL
- Kotlin
- list
- dataframe
- Google Excel
- gas
- SQL
- c#
- Mac
- Redshift
- Google Spreadsheet
- Tkinter
- GIT
- 파이썬
- matplotlib
- hive
- Github
- Python
- PANDAS
- string
- numpy
- django
- Java
- math
- array
- Apache
- Today
- Total
목록Regular Expression (3)
달나라 노트
String 객체의 replace method는 특정 문자나 패턴을 찾아서 원하는 문자로 바꿔주는 기능을 합니다. Syntax String.replace(old_text, new_text) replace method는 String에 적용할 수 있으며 2개의 parameter를 받습니다. - old_text String에서 찾을 기존 text입니다. 여기는 text 대신 regular expression도 들어갈 수 있습니다. - new_text 새로 변경할 텍스트입니다. function myFunction(){ var test_string = 'Apple'; Logger.log(test_string.replace('ppl', 'abc')); Logger.log(test_string.replace(/[a-..
String 객체의 match와 search는 String에서 특정 문자열을 찾아줍니다. 이 두 method의 사용법과 차이점을 봅시다. Syntax String.match(text/reg) match method는 String에 적용할 수 있으며 1개의 parameter를 받습니다. - text/reg String에서 찾을 문자(text) 또는 정규표현식(reg, regular expression)입니다. match method는 String에서 text/reg와 일치하는 문자를 찾아 그 문자를 array에 담아서 return해줍니다. 여기서 특이한 점은 정규표현식(regular expression)을 사용할 수 있다는 것이죠. String.search(text/reg) search method도 St..
Python re library의 findall method는 문자열 내에서 특정 패턴을 만족하는 모든 문자열을 return해줍니다. Syntax findall(pattern, text) - pattern 찾을 문자열의 pattern을 입력하는 부분입니다. - text 문자열을 찾을 대상 텍스트를 의미합니다. 정리해보면 text에서 pattern과 일치하는 부분을 모두 찾아 return해주는 것이 findall method의 기능이라고 볼 수 있습니다. import re str_text = 'apple_banana' list_result = re.findall(r'apple', str_text) print(list_result) -- Result ['apple'] 위 코드는 apple_banana 라는 ..