In Perl it is possible to do something like this (I hope the syntax is right...):
$string =~ m/lalala(I want this part)lalala/; $whatIWant = $1;
import re match = re.match('lalala(I want this part)lalala', 'lalalaI want this partlalala') print match.group(1)