r/csharp•
Haldiron

Question for the Regex inclined

I have a list of objects, and those objects have a few "string" properties.

Given a list that looks like this (string properties separated by ::):

1.2.1.a_1 :: Doc-5, Doc-7 1.2.2.b_2 :: Int-2 1.3.2.b_1 :: I reviewed Doc-5 and Doc-7 and interviewed Int-2 and blahblahblah.

I would like to make an function that will take the text of 1.3.2.b_1 and change it to "I reviewed 1.2.1.a_1 and interviewed 1.2.2.b_2 and blahblahblah". Bear in mind there will also be many objects before and after the above snippet, so I would want it to stop after the first time it found "Int-2" in a preceding object.

Any thoughts from you Regex Seers? Scantily-clad virgins and the gold offering will be at the regular location in the temple.

Posted Jan 5, 2017, 11:21 PM UTC

13
Loading comments…