Reputation: 638
I'm reallllly new to regex and I need some help. I tried figuring out myself but had no luck!
I am trying to select text between 2 strings (character for the last string)
ie:
word word2 :
I am trying to select "word2" between word and :
thanks!
Upvotes: 14
Views: 41088
Reputation: 7
Here is a regex that can find a guid inbetween anything guid anything or same around this is using dot net syntax and named capture with back reference. The anything capture syntax (.*?) is reused before and after the guid. So if there is an identifier somewhere in a Pat element or a App element this will find all of either.
[<](?<PatOrApt>Pat|App)[>](.*?)59358d09-8acd-4635-a019-1cbf9e1ed2db(.*?)[<][/]\k<PatOrApt>[>]
Upvotes: 0
Reputation: 263703
another alternative is to use this pattern
(?<=word\s).*(?=\s:)
See Lookahead and Lookbehind Zero-Width Assertions
Upvotes: 14