I currently have a regex which works fine for certain type of input.
Reg Ex: (.*)\s*PER\s*([^\s]+).*
Sample Input 1 : 1.0 PER Sample DEAD VOLUME 1
Output:
Matching Group 1 : 1.0
Matching Group 2 : Sample
Sample Input 2 : 1.0 PER Request DEAD VOLUME 1
Output:
Matching Group 1 : 1.0
Matching Group 2 : Request
Now i need to modify the regex to also work for inputs like below.
Input 1 : 10.0 PER Empty Well In Column DEAD VOLUME 10
Expected Output:
Matching Group 1 : 10.0
Matching Group 2 : Empty Well
Matching Group 3 : Column
Input 2 : 8.0 PER Empty Well In Row DEAD VOLUME 8
Expected Output:
Matching Group 1 : 8.0
Matching Group 2 : Empty Well
Matching Group 3 : Row
I have found a reg ex which processes the second type of inputs successfully.
RegEx: (.*)\s*PER\s*(.*)\s*In\s*(.*)\s*DEAD\s*.*
Is there way i can make a regex which will work for both these type of inputs
UPDATE:
Hi Just need one more help...I forgot to mention one more condition...This reg also needs to work for the below inputs.
- 1.0 PER Sample
- 1.0 PER Request
- 10.0 PER Empty Well In Column
Meaning the DEAD VOLUME portion is an optional one.
Is this possible too????