perl程序设计技巧
1. Why does POE pass parameters as array slices? http://poe.perl.org/?POE_FAQ/calling_convention 2. perl regular expression fast referecnces metacharacters are {}[]() ^ $ . | * + ? a metacharacter can be matched by putting a backslash befo
1. Why does POE pass parameters as array slices?
http://poe.perl.org/?POE_FAQ/calling_convention
2. perl regular expression fast referecnces
metacharacters are
{ } [ ] ( ) ^ $ . | * + ?
a metacharacter can be matched by putting a backslash before it
anchor metacharacters ^ and $ .
The anchor ^ means match at the beginning of the string and the anchor $ means match at the end of the string, or before a newline at the end of the string.
"housekeeper" =~ /keeper/; # matches
"housekeeper" =~ /^keeper/; # doesn't match
"housekeeper" =~ /keeper$/; # matches
"housekeeper " =~ /keeper$/; # matches
/cat/; #matches 'cat'
/[bcr]at/; #matches 'bat', 'cat', or 'rat'
/item[0123456789]/; #matches 'item0' or ... or 'item9'
"abc" =~ /[cab]/; #matches 'a'
/[yY][eE][sS]/ can be rewritten as /yes/i.
The special characters for a character class are - ] / ^ $ (and the pattern delimiter, whatever it is). ] is special because it denotes the end of a character class. $ is special because it denotes a scalar variable. / is special because it is used in escape sequences.
/[/]c]def/; # matches ']def' or 'cdef'
$x = 'bcr';
/[$x]at/; # matches 'bat', 'cat', or 'rat'
/[/$x]at/; # matches '$at' or 'xat'
/[//$x]at/; # matches '/at', 'bat, 'cat', or 'rat'
/item[0-9]/; # matches 'item0' or ... or 'item9'
/[0-9bx-z]aa/; # matches '0aa', ..., '9aa',
# 'baa', 'xaa', 'yaa', or 'zaa'
/[0-9a-fA-F]/; # matches a hexadecimal digit
/[0-9a-zA-Z_]/; # matches a "word" character, # like those in a Perl variable name
The special character ^ in the first position of a character class denotes a negated character class, which matches any characters but those in the brackets.
/[^a]at/; # doesn't match 'aat' or 'at', but matches
# all other 'bat', 'cat, '0at', '%at', etc.
/[^0-9]/; # matches a non-numeric character
/[a^]at/; # matches 'aat' or '^at'; here '^' is ordinary
/d matches a digit, not just [0-9] but also digits from non-roman scripts
/s matches a whitespace character, the set [/ /t/r/n/f] and others
/w matches a word character (alphanumeric or _), not just [0-9a-zA-Z_] but also digits and
characters from non-roman scripts
/D is a negated /d; it represents any other character than a digit, or [^/d]
/S is a negated /s; it represents any non-whitespace character [^/s]
/W is a negated /w; it represents any non-word character [^/w]
The period '.' matches any character but "/n" (unless the modifier //s is in effect, as explained
below).
//d/d:/d/d:/d/d/; # matches a hh:mm:ss time format
/[/d/s]/; # matches any digit or whitespace character
//w/W/w/; # matches a word char, followed by a
# non-word char, followed by a word char
/..rt/; # matches any two chars, followed by 'rt'
/end/./; # matches 'end.'
/end[.]/; # same thing, matches 'end.'
regexp dog|cat. As before, Perl will try to match the regexp at the earliest possible point in the
string. At each character position, Perl will first try to match the first alternative, dog. If dog doesn't
match, Perl will then try the next alternative, cat. If cat doesn't match either, then the match fails and
Perl moves to the next position in the string.
"cats and dogs" =~ /cat|dog|bird/; # matches "cat"
"cats and dogs" =~ /dog|cat|bird/; # matches "cat"
/(a|b)b/; # matches 'ab' or 'bb'
/(ac|b)b/; # matches 'acb' or 'bb'
/(^a|b)c/; # matches 'ac' at start of string or 'bc' anywhere
/(a|[bc])d/; # matches 'ad', 'bd', or 'cd'
/house(cat|)/; # matches either 'housecat' or 'house'
/house(cat(s|)|)/; # matches either 'housecats' or 'housecat' or
# 'house'. Note groups can be nested.
/(19|20|)/d/d/; # match years 19xx, 20xx, or the Y2K problem, xx
"20" =~ /(19|20|)/d/d/; # matches the null alternative '()dd',
# because '20dd' can't match

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

Win11小技巧分享:一招跳过微软账户登录Windows11是微软最新推出的操作系统,具有全新的设计风格和许多实用的功能。然而,对于一些用户来说,在每次启动系统时都要登录微软账户可能会感到有些烦扰。如果你是其中一员,不妨尝试一下以下的技巧,让你能够跳过微软账户登录,直接进入桌面界面。首先,我们需要在系统中创建一个本地账户,来代替微软账户登录。这样做的好处是

我们经常在excel中制作和编辑表格,但是作为一个刚刚接触软件的新手来讲,如何使用excel制作表格,并没有我们使用起来那么轻松。下边,我们针对新手,也就是初学者需要掌握的表格制作的一些步骤进行一些演练,希望对需要的人有些帮助。新手表格示例样板如下图:我们看看如何来完成!1,新建excel文档,有两种方法。可以在【桌面】空白位置,点击鼠标右键-【新建】-【xls】文件。也可以【开始】-【所有程序】-【MicrosoftOffice】-【MicrosoftExcel20**】2,双击我们新建的ex

C语言中,表示指针,存储其他变量的地址;&表示地址运算符,返回变量的内存地址。指针的使用技巧包括定义指针、解引用指针,需确保指针指向有效地址;地址运算符&的使用技巧包括获取变量地址,获取数组元素地址时返回数组第一元素地址。实战案例说明了使用指针和地址运算符反转字符串。

VSCode(VisualStudioCode)是一款由微软开发的开源代码编辑器,具有强大的功能和丰富的插件支持,成为开发者们的首选工具之一。本文将为初学者们提供一个入门指南,帮助他们快速掌握VSCode的使用技巧。在本文中,将介绍如何安装VSCode、基本的编辑操作、快捷键、插件安装等内容,并为读者提供具体的代码示例。1.安装VSCode首先,我们需

标题:PHP编程技巧:如何实现3秒内跳转网页在Web开发中,经常会遇到需要在一定时间内自动跳转到另一个页面的情况。本文将介绍如何使用PHP实现在3秒内实现页面跳转的编程技巧,并提供具体的代码示例。首先,实现页面跳转的基本原理是通过HTTP的响应头中的Location字段来实现。通过设置该字段可以让浏览器自动跳转到指定的页面。下面是一个简单的例子,演示如何在P

Win11技巧大揭秘:如何绕过微软账户登录近期,微软公司推出了全新的操作系统Windows11,引起了广泛关注。相比之前的版本,Windows11在界面设计、功能改进等方面做出了许多新的调整,但也引发了一些争议,其中最引人关注的一点就是强制要求用户使用微软账户登录系统。对于一些用户来说,他们可能更习惯于使用本地账户登录,而不愿意将个人信息与微软账户绑定。

随着《暗黑4》登陆XGP以及《流放之路》放出大量新情报。在3月的最后一周,我们又将看到一场暗黑like游戏的抢人大战。首先来聊聊已经发售一年,让人又爱又恨的《暗黑破坏神4》。此前预告了有小半年的光线追踪特性,终于要在3月26日正式加入到游戏内。新增的光线追踪效果将带来一系列视觉增强,如盔甲、水面、窗户和其他反射表面上的光线追踪反射,以及光线追踪阴影。然而,鉴于光追特效对显卡资源有较高要求,若你的电脑配置未能达到相应标准,恐难以保证游戏的流畅运行。紧接着的3月28日,《暗黑破坏神4》将正式加入Ga

在编写网站或应用程序时,表单是不可或缺的一部分。Laravel作为一款流行的PHP框架,提供了丰富而强大的表单类,使得表单处理变得更加简单和高效。本文将介绍一些Laravel表单类的使用技巧,帮助你提高开发效率。下面通过具体的代码示例来详细讲解。创建表单要在Laravel中创建表单,首先需要在视图中编写相应的HTML表单。在处理表单时,可以使用Laravel
