Hi,
I am trying to extract some fields which are generally bound by other strings (eg Some Text 1 Some Text 2). I have a situation where a field may or may not have anything following it.
For example, with this data set :
1 Some Text 1 <my field 1> Some Text 2
2 Some Text 1 <my field 1>",
3 Some Text 1 <my field 1> Some Text 2
4 Some Text 1 <my field 1> Some Text 2
5 Some Text 1 <my field 1>",
This regex partly works in that is extracts correctly items 1, 3, and 4:
Some Text 1\s+(?P<my field 1>.+)\s(Some Text 2|\",)
This regex partly works in that is extracts correctly items 2 and 5, but extracts the entirety of items 1, 3, and 4.
Some Text 1\s+(?P<my field 1>.+)(Some Text 2|\",)
The difference is the "\s". I can't seem to include that in the match group, only before it.
I am sure I am missing something obvious but can't seem to see it. Any help much appreciated.
Thankyou.
... View more