Regular Expression To Match Multiple Lines Of Text
I am trying to match lines that start with and end with the following tags using regular expressions:
<Description>
</Description>Inbetween the tags, there can be multiple lines of text, how can I match this value? Example description tag:
<Description> test1 test2 test3 test4
</Description>I tried multiple variants of regular expressions which have not worked, here's the latest one I tried:
<Description>(\n.*)</Description>EDIT: I am using Visual Studio 17s find/replace component when using regular expressions. Also, there are multiple instances of the description tags.
22 Answers
This works for me in Visual Studio:
<Description>(\n|.)*?</Description>It searches for end-of-line or any character, repeated, but not greedy (?).
Try:
<Description>([\s\S]*)</Description> 1