I have the regex from a sql query:

| Steven | 149203948 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Ut eu lacus gravida, lobortis nulla eu, fringilla erat. 
Nullam vulputate vitae lacus quis sagittis. 
Donec elementum nisl vitae arcu pulvinar tristique. 

| Frank | 993847 |
Morbi bibendum facilisis risus. 
Nullam facilisis, lectus nec adipiscing vehicula, urna nisi rhoncus urna, 
at egestas purus nisl a sapien. 
Suspendisse ac sapien ut eros luctus eleifend ac sit amet odio. 

Etc etc

I'm trying to select the "name", "number" and the entire list of "Lorem Text" so that I can create a sql update statement for each lorem phrase by replacing a particular word with another word.

So I could do

UPDATE person p
SET p.lorem_text = '
$3 CHANGED TEXT $4'
WHERE p.name = $1 AND p.favorite_number = $2;

For all the entries I get back from my query. The problem is the stupid newlines, I tried using

\| (\w*) \| (\d*) \| ((.|\R)*)OLD TEXT((.|\R)*)

But it only gets the first occurence and leaves the rest (| Frank | 993847 | etc) as the entire tail end of my selection.

没有正确的解决方案

其他提示

\| (\w*) \| (\d*) \| ([^|]*)

The rest of regex is simplified

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top