I want to find a string that begins with http://
and ends with .com
.
but the http://
and .com
it doesn't need to be printed.
$str = "http://example.com";
$str =~ /http:\/\/example.com/;$result = "$&\n";
print $result;
essentially the same as that done with python.
#!/usr/bin/python
import re
str = 'http://example.com'
search = re.search(r'http://(\w+).com', str)
if search:
print search.group(1)
it will only show "example". How to do it in Perl?