Perl正则表达式

From Yefu's notes
Jump to: navigation, search

The above returns true if string $string contains substring "sought_text", false otherwise. If you want only those strings where the sought text appears at the very beginning, you could write the following: $string =~ m/^sought_text/; Similarly, the $ operator indicates "end of string". If you wanted to find out if the sought text was the very last text in the string, you could write this: $string =~ m/sought_text$/;