Creating some regex expressions here. I was wondering if I could get some pointers on how to go about selecting a string after n occurences of one character and before the next occurence of a certain char.
for instance
xyz|yui|i want to select this.
In this example I am wanting to select after the 2nd “|” and before the next “.”. So the text I want to match is “i want to select this”.
I appreciate any pointers thanks.
UPDATE
To be more specific on why I need to do this above, there is more text after the period at the end of “I want to select this.”. Basically this is undelimited content which I am trying to delimit. Thusfar I have been able to delimt the first two fields, now I need to be able to select only text after the last “|” and before the next period and add a “|” character to the end. So the desired result would be
xyz|yui|i want to select this.|
Sorry for not being more specific on the outcome and I hope this clears it up a bit. Thanks for the info, its super.
First you need to create a group which contains the repeating part
([^|]+\|)here, which can be set to appear exactly two times{2}, then you need to match the rest(.*):Update
You can ungroup it as @Karolis mentioned with
?:WIth the first regexp the second match will be yours, with the second it will be the first.