This regex uses non capturing groups to start the match on the first field and then continue to match second field.
SEGMENT|(?:[^|]|){}|(?:[^|]|){}
SEGMENT is the first segment that has field to match on is the zero based count of the field in first segment is the value to match on in the field in first segment. is the zero based count of the fields from POSITION1 to field in segment of second field is the value to match on in the field in the second segment
Example Searching for message with PV1-19 of 1703000105 and ORC-1 of CO, where PV1 has 50 fields and is followed by ORC segment PV1|(?:[^|]|){18}1703000105|(?:[^|]|){31}CO