Skip to content

Instantly share code, notes, and snippets.

@back2arie
Created October 20, 2012 06:36
Show Gist options
  • Save back2arie/3922376 to your computer and use it in GitHub Desktop.
Save back2arie/3922376 to your computer and use it in GitHub Desktop.
Get text between tag
#!/opt/local/bin/perl
$string = "<TEXT>
First text
Some text
Last text
</TEXT>";
if($string =~ /<(TEXT)>\s*(.*)\s*<\/\1>/gs)
{
$result = $2;
print $result, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment