hello world
regex: hello
hello
world
Hello my friend, my fellows
// regex: my
결과: Hello my
friend, my
fellows
⇒ 대다수 정규식에서는 일치하는 부분을 리턴한다.
.
를 사용하면 아무 문자 하나와 일치하는 것을 찾는다.// Q: report가 포함된 report + 1 의 문자를 찾아라
lecture2000.txt
report1.txt
spring.ppt
report9.ppt
report.png
// regex: report.
lecture2000.txt
report1
.txt
spring.ppt
report9
.ppt
report.
png
⇒ report로 시작하고 뒤에 아무 문자가 한개 붙는 것을 찾아냈다.
⇒ 전체 파일과 일치하는 것이 아니다. 문자에는 report.png처럼 .
자체를 조회가능하다.
.
을 동시에 써서 일치하는 값을 가져올 수 있다.