I have an excel sheet that looks like this:
+-------+------+-------+------+------------+
| A | B | C | D | E |
+---+-------+------|-------+------+------------+
| 1 | Location | Duration | Delay |
+---+--------------+--------------+------------+
| 2 | Ware House-1 | 2.3 Hr. | No Power |
+---+--------------+--------------+------------+
| 3 | Stg. Area 2 | 15 Min. | Out of |
| | | | materials. |
+---+--------------+--------------+------------+
| 4 | Gate #7 | | No Delays |
+---+--------------+--------------+------------+
Users are expecting to copy cells (A2:E4) from excel and paste into my text area.
Notice the marged cells (columns A,B, and C,D). When these cells are pasted, the TAB
character appears twice after the values of these cells.
I am trying to use Regex to capture values in each row.
^(?<location>[^t]+)tt(?<duration>[^t]+)?tt(?<delay>[^n]+)n
The problem I am facing is the value in column E can span multiple lines. Causing Excel to force a "
before and after the value. This messes up my regex capturing. So I decided to adapt the regex to either expect a single or multiple lines:
^([^t]+)tt([^t]+)?tt((?:"([^"]+n[^"]+)")|([^t]+))
The above regex works fine in VS Code, but when I try it in C# regex, it give me the error message:
Error: parsing "^([^t]+)tt([^t]+)?tt((?:"([^"]+n[^"]+)")" - Not enough )'s.
How can I capture these values in C# (expecting a double quotes multi-line, or a single line with no quotes)?