print "Enter string:\n";
$sentence = <>;
print "Enter the regex to use for search:\n";
$regex = <>;
if ($sentence =~ $regex){
print "Matching\n";
}
else{
print "Not matching";
}
print "Match found: ", # This should show the text that is found by the regular expression that is typed by the user.
Здравствуйте, у меня проблемы с кодом. Это то, что я набираю в следующих полях. $ предложение: Быстрая лиса. $ regex: q. * k. $ Regex не совпадает с предложением $. Нужно ли мне преобразовывать $ regex? Кроме того, как я могу напечатать соответствующий текст в конце? Примерно так.
Enter string:
The quick fox
Enter the regex to use for search:
q.*k
Matching
Match found: quick