[oXygen-user] How to match across multiple lines using regex?

Wendell Piez wapiez at wendellpiez.com
Sat Jan 11 15:31:48 CST 2014


Hi,

I think Ken misread the problem but solved it anyway.

Shouldn't the "dot matches all" take care of the line breaks, while
the ? (correctly placed) in the expression prevents it from being too
greedy?

So, something like "doc:.+?</a:documentation>" ?

Cheers, Wendell

Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^


On Sat, Jan 11, 2014 at 4:08 PM, G. Ken Holman
<gkholman at cranesoftwrights.com> wrote:
> At 2014-01-11 13:17 -0600, Eliot Kimber wrote:
>>Content-Language: en-US
>>Content-Type: text/plain; charset="utf-7"
>>
>>I+IBk-m trying to a regular expression search and replace for things
>>like this:
>>
>>doc: text text
>>next line
>>next line+ADw-/a:documentation+AD4-
>>
>>What I can+IBk-t figure out is how to do this multi-line regular expression
>>match. If use +IBw-dot matches all+IB0- then my match is not limited to just
>>what+IBk-s shown but everything between the first doc: and the last
>>+ADw-/a:documentation+AD4-.
>>
>>If do e.g. +IBw-doc:(.)+ADw-/a:documentation+AD4gHQ- then it matches
>>cases where it all
>>happens to be on one line.
>>
>>Is this possible? What bit of regex fu am I missing?
>
> I think it is the use of "\n".
>
> Try this to include all of the lines:   doc:((.|\n)*?):documentation
>
> (note that I'm guessing what your boundaries are because of a mailer problem)
>
> I hope this helps.
>
> . . . . . . . . Ken
>
> --
> Public XSLT, XSL-FO, UBL & code list classes: Melbourne, AU May 2014 |
> Contact us for world-wide XML consulting and instructor-led training |
> Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm |
> Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/ |
> G. Ken Holman                   mailto:gkholman at CraneSoftwrights.com |
> Google+ profile:      http://plus.google.com/+GKenHolman-Crane/about |
> Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user


More information about the oXygen-user mailing list