user3821361
user3821361

Reputation: 35

Regular Expression over multiple lines (Search+Replace)

Im trying to search and replace parts of a huge xml file and am stuck with getting a correct regular expression for something like this

<Start id="AUTO_TEXT"...>
    MORE TEXT
    MORE TEXT
</Start>

I always end up writing something like this, which isn't working:

<Start id="AUTO_[^/r]*<\/Start>

What am I missing?

Oh, I'm using EditPad Pro which uses the "The Just Great Software Regular Expression Engine" (Wow, what a name)

Upvotes: 0

Views: 159

Answers (1)

zx81
zx81

Reputation: 41838

Tested in EditPadPro:

(?s)<Start id="AUTO.*?</Start>

Explanation

  • (?s) activates DOTALL mode, allowing the dot to match across lines
  • The star quantifier in .*? is made "lazy" by the ? so that the dot only matches as many characters as needed to allow the next token to match (shortest match).

Option 2

Instead of using (?s), you can also press the Dot toggle in the search bar.

EPP

Upvotes: 1

Related Questions