regular expression for random word wrap to multiple line

Hi all, I am not sure this is an old topic or not, but I cannot seem to find an answer for this. I have a table, because of the table column width restriction, some of the line in a table row/field gets wrapped around to second/third lines. Here is a simple illustrated the issue: sales and marketing (excludes stock-based compensation of $817, $369 and $113 for 2005, 2004 AND 2003, RESPECTIVELY) 74,823 36,000 21,162 As you can see the description txt gets break down into three lines. If I write something like this "^sales and marketing (excludes stock-based compensation of", it's not gonna capture the entire line that ended with numbers. The exact location where the line gets wrapped around is not known, so it's impossible to craft the regular expression like this beforehand. Is there a way to write *ONE* regular expression to handle this? /Winson.

Winson Yung wrote:
Hi all, I am not sure this is an old topic or not, but I cannot seem to find an answer for this. I have a table, because of the table column width restriction, some of the line in a table row/field gets wrapped around to second/third lines. Here is a simple illustrated the issue:
As you can see the description txt gets break down into three lines. If I write something like this "^sales and marketing (excludes stock-based compensation of", it's not gonna capture the entire line that ended with numbers. The exact location where the line gets wrapped around is not known, so it's impossible to craft the regular expression like this beforehand.
Is there a way to write *ONE* regular expression to handle this?
Sure just separate the words with \\s+ to give something like: "sales\\s+and\\s+marketing\\s+\\(\\s*excludes\\s+" "stock-based\\s+compensation\\s+of\\s+\\$(\\d+)" ",\\s+\\$(\\d+)\\s+and\\s+\\$(\\d+).+RESPECTIVELY\\)" "([\\d,.]+)\\s+([\\d,.]+)\\s+([\\d,.]+)" Which extracts the six numbers as six sub-expressions. Does that help? John.

Winson Yung wrote:
Hi all, I am not sure this is an old topic or not, but I cannot seem to find an answer for this. I have a table, because of the table column width restriction, some of the line in a table row/field gets wrapped around to second/third lines. Here is a simple illustrated the issue:
As you can see the description txt gets break down into three lines. If I write something like this "^sales and marketing (excludes stock-based compensation of", it's not gonna capture the entire line that ended with numbers. The exact location where the line gets wrapped around is not known, so it's impossible to craft the regular expression like this beforehand.
Is there a way to write *ONE* regular expression to handle this?
Sure just separate the words with \\s+ to give something like: "sales\\s+and\\s+marketing\\s+\\(\\s*excludes\\s+" "stock-based\\s+compensation\\s+of\\s+\\$(\\d+)" ",\\s+\\$(\\d+)\\s+and\\s+\\$(\\d+).+RESPECTIVELY\\)" "([\\d,.]+)\\s+([\\d,.]+)\\s+([\\d,.]+)" Which extracts the six numbers as six sub-expressions. Does that help? John.

John Maddock wrote:
Is there a way to write *ONE* regular expression to handle this?
Sure just separate the words with \\s+ to give something like:
"sales\\s+and\\s+marketing\\s+\\(\\s*excludes\\s+" "stock-based\\s+compensation\\s+of\\s+\\$(\\d+)" ",\\s+\\$(\\d+)\\s+and\\s+\\$(\\d+).+RESPECTIVELY\\)" "([\\d,.]+)\\s+([\\d,.]+)\\s+([\\d,.]+)"
There's a bug in that expression: I got tired of typing out all yout expected text and inserted a .* in there. That would have to be made non-greedy or else removed and replaced with the words you're expecting separating by more \\s+ separators. John.
participants (2)
-
John Maddock
-
Winson Yung