【发布时间】:2020-06-26 17:17:38
【问题描述】:
我是 Perl 和正则表达式的新手,我很难提取用双引号括起来的字符串。比如,
“堆栈溢出是 惊人的”在我提取字符串之前,我想检查它是否是整个文本的行尾是否在变量中:
if($wholeText =~ /\"$/) #check the last character if " which is the end of the string
{
$wholeText =~ s/\"(.*)\"/$1/; #extract the string, removed the quotes
}
我的代码不起作用;它没有进入if 条件。
【问题讨论】:
-
快速让自己看起来不像个菜鸟:正确地将语言称为 Perl。
-
谢谢,但很困惑,有人告诉我应该使用 PERL 而不是 Perl。
-
有些人错了——是 Perl。
-
这和那个有什么不同:stackoverflow.com/questions/1479565/…
-
@Manni:没有什么不同。投票结束。