나는 루비에서 다음 텍스트를 가지고 있는데, 나는 ----과 ---- (내용) 사이의 부분만을 추출하고 싶지만 그렇게 할 수는 없다.루비에서 텍스트 섹션을 얻는 방법
mystring.match(/^-*(.*?)^-*/m)[1]
이 텍스트입니다 :
Congrats! You just got a new contact lead
Here's the information your contact submitted:
------------------------------------------------------------------------------------
Name: testing
Email: [email protected]
Mensaje: hello
this is a nice test
------------------------------------------------------------------------------------
For your convenience, we have automatically added this contact and message to your account.
Best of luck!
- LeadABC
'm'은 무엇을합니까? – oldergod
@oldergod 멀티 라인 모드. '.' 매치 개행을 만드십시오. – alex
뒷면 참조를 잘 사용합니다. '-----'줄의 길이가 모두 같다고 가정합니다. –