How to write this in different regex flavours

Posted by taspeotis on Stack Overflow See other posts from Stack Overflow or by taspeotis
Published on 2010-04-13T02:21:13Z Indexed on 2010/04/13 2:22 UTC
Read the original article Hit count: 448

Filed under:

I have the following data:

a b c d FROM:<uniquepattern1>
e f g h TO:<uniquepattern2>
i j k l FROM:<uniquepattern1>
m n o p TO:<uniquepattern3>
q r s t FROM:<uniquepattern4>
u v w x TO:<uniquepattern5>

I would like a regex query that can find the contents of TO: when FROM:<uniquepattern1> is encountered, so the results would be uniquepattern2 and uniquepattern3.

I am hopeless with regex, I would appreciate any pointers on how to write this (lookahead parameters?) and any differences between regex on different platforms (eg the C# .NET Regex versus Grep vs Perl) that might be relevant here.

Thank you.

© Stack Overflow or respective owner

Related posts about regex