You are viewing limited content. For full access, please sign in.

Question

Question

Problem with grabbing multiple lines in Workflow Pattern Matching

asked on September 17, 2015

I'm trying to grab multiple lines that come after the word "Comments" and before the line that starts with "Report ID", but I'm stuck at one point. If you look at the picture below, you can see what I have set up so far. The expression I've set up so far can grab the first line "OE Change Over Program - John R. Jurgensen", but it does not grab any of the next lines. 

There is no way of telling how many lines will appear between "Comments" and "Report ID", it could be one line or three lines or ten. Please help, thanks.

0 0

Answer

SELECTED ANSWER
replied on September 18, 2015

I wasn't able to get Berts to work, may be a quirk, but here's a work around I've used for scenarios like this.

 

(?:COMMENTS)([^\a]*)(?:Report ID)

 

1 0

Replies

replied on September 18, 2015

Try this for your regular expression

Comments\s+(.*)\s+Report\s+ID

 

1 0
replied on September 18, 2015

I’ve had similar success using:

COMMENTS:\n*.*\s*(.+)*Report ID:

replied on September 18, 2015

Carl is on to something, that expression is working so that it pulls any lines that I have between "Comments" and "Report ID". I just have one more issue. If you check the "Show line break characters as /r and /n" at the bottom, you'll see the line break characters being captured as well. I need those removed. In the picture below, I was able to modify Carl's expression so that it removes the first pair of line breaks:

But as you can see, there are two more after that. Is there something that can be added to this expression that I can use to get rid of any number of line breaks that may appear?

0 0
replied on September 18, 2015

If you set it to "all matches combined without space" you'll get what you want. If you want to have a space in between the end of the first line and the beginning of the second line, then set it to "all matches as a multi-value token" and then use token formatting to insert the space when you use the token somewhere else

1 0
replied on September 22, 2015

Wanted to thank everyone for your responses... I believe that we got close to what the client needs with Carl's answer and Miruna's suggestion, they are working with it now.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.