ruby-on-railsrubyregexrubular

Regular expression for XML tag


I am having a hard time matching the following text:

<Reports>
   <Report active="1" valid="1" bureau="EXS"> Dummy Dummy</Report>
</Reports>

Using the following Regex:

/<Reports>.*<\/Reports>/

I am using rubular (I am using ruby) to test it , but I don't understand why my RegEx fails.

http://rubular.com/r/QEhgQ9Vgla

Any help?


Solution

  • You need to include multiline modifier m.

    /<Reports>.*<\/Reports>/m
    

    DEMO