I want to extract data from string where first delimiter is fixed but second delimiter is bit changing.
Sample Example:
Input:
" There are some numbers 234 xys XB1- given string i want ph no- 9766 also check to find next hypen 12A- khhhdhd snsjsjsk djdjdjdj-"
Output i want:
“given string i want ph no- 9766 also check to find next”
I.e. between XB1- and 12A-
But problem is XB1 is fixed but 12A- is changing
It can be 13A- or 17A- or 12B- or any other.
2A is not fixed.
Input can be:
" There are some numbers 234 xys XB1- Customer Id 12346, add- XYZ company 15A- khhhdhd snsjsjsk djdjdjdj-"
Output should be:
“Customer Id 12346, add- XYZ company”
Input can be:
" There are some numbers 534 xys XB1- Customer Id 8765-9876, add- ABC company 12B- kkkgff 467 djdjdjdj-"
Output should be:
“Customer Id 8765-9876, add- ABC company”
Input can be:
“There are some numbers 534 xys XB1- Customer Id 87659876, add,JJ company 18B- kkkgff 467 djdjdjdj-”
Output should be:
“Customer Id 87659876, add,JJ company”
Note- second delimiter i.e.( 15A- ,12B- ,18B-)
XB1- will always constant.
I want second delimiter as string which contain (exact 2 numbers and - at the end) as a delimiter.
Second delimiter always contain 2 numbers and ‘-’ at the end.
There is once issue if multiple pattern is occured at the end.
Sample
Input can be:
" There are some numbers 234 xys XB1- Customer Id 12346, add- XYZ company 15A- khhhdhd snsjsjsk djdjdjdj 16A- Company detail and others 17A- customer details with number."
Output should be:
“Customer Id 12346, add- XYZ company”
But it is giving me till-
“Customer Id 12346, add- XYZ company 15A- khhhdhd snsjsjsk djdjdjdj 16A- Company detail and others”
I want second delimiter should be first matching pattern in this case it should ve 15A-
Basically it should check first matching pattern for second delimiter.