Perl中while修饰符的c参数如何改写为长尾?
- 内容介绍
- 文章标签
- 相关推荐
本文共计157个文字,预计阅读时间需要1分钟。
在Oracle数据库中,使用`cat`命令可以查看或修改一个特定的文件内容。以下是对您提供的命令的简化
查看Oracle配置文件tmpperl01的内容
[oracle@localhost ~]$ cat tmpperl01
#!/usr/bin/perl
$_ = "The year 1752 lost 10 days on the 3rd of September";
while (/(\d+)/g)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
while (/e/g)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
[oracle@localhost ~]$ cat tmpperl02
#!/usr/bin/perl
$_ = "The year 1752 lost 10 days on the 3rd of September";
while (/(\d+)/cg)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
while (/e/cg)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
[oracle@localhost ~]$ ./tmpperl01
13
21
35
---
3
6
33
43
46
49
---
[oracle@localhost ~]$ ./tmpperl02
13
21
35
35---
43
46
49
49---#增加/c修饰符在匹配失败后不重置pos的位置
本文共计157个文字,预计阅读时间需要1分钟。
在Oracle数据库中,使用`cat`命令可以查看或修改一个特定的文件内容。以下是对您提供的命令的简化
查看Oracle配置文件tmpperl01的内容
[oracle@localhost ~]$ cat tmpperl01
#!/usr/bin/perl
$_ = "The year 1752 lost 10 days on the 3rd of September";
while (/(\d+)/g)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
while (/e/g)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
[oracle@localhost ~]$ cat tmpperl02
#!/usr/bin/perl
$_ = "The year 1752 lost 10 days on the 3rd of September";
while (/(\d+)/cg)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
while (/e/cg)
{
print pos($_),"\n";
}
print pos($_)."---","\n";
[oracle@localhost ~]$ ./tmpperl01
13
21
35
---
3
6
33
43
46
49
---
[oracle@localhost ~]$ ./tmpperl02
13
21
35
35---
43
46
49
49---#增加/c修饰符在匹配失败后不重置pos的位置

