Reputation: 359
I have the same issue of this post
but I'm using Google Spreadsheet. Even though it's not considered a "programming" topic, regex syntax it be the same.
I need to extract text between two tags. Eg:
START sample text END
When I apply this regex syntax everything works:
"START(.*)END"
But if the sample text contains a new line it does not. Any hints?
Upvotes: 1
Views: 3124
Reputation: 27262
If you want to get rid off the new line character, one solution would be to replace the new line character with "", e.g:
=regexextract(regexreplace(A1, "\n", ""), "START (.+) END")
If you want to keep the new line character, you could try:
=regexextract(A1, "START (\w+\n\w+) END")
Alternatively if you want a solution that works with strings WITH and WITHOUT new line character, try:
=regexextract(A1, "START (\w+|\w+\n\w+) END")
Upvotes: 4