Regex get each occurrence with newlines

  •  | 
  •   ( words)


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 = '
WHERE = $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.

No correct solution


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

The rest of regex is simplified

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow