PERL Regular Expressions

PEG(Parsing Expression Grammars)介绍 PEG = Parsing Expression Grammars 这是MIT介绍PEG的slides,有使用ruby treetop或PEG.js前需要了解的PEG基础知识. 立即下载

Troubleshooters.Com and Code Corner Present

Steve Litt's PERLs of Wisdom:
PERL Regular Expressions
(With Snippets)

Copyright (C) 1998-2001 by Steve Litt

Steve Litt is the author of Troubleshooting Techniques of the Successful Technologist,  Rapid Learning: Secret Weapon of the Successful Technologist, and Samba Unleashed.

Contents

Introduction

Without regular expressions, PERL would be a fast development environment. Probably a little faster than VB for console apps. With the addition of regular expressions, PERL exceeds other RAD environments five to twenty-fold in the hands of an experienced practitioner, on console apps whose problem domains include parsing (and that's a heck of a lot of them).

Regular expressions is a HUGE area of knowledge, bordering on an art. Rather than regurgitate the contents of the PERL documentation or the plethora of PERL books at your local bookstore, this page will attempt to give you the 10% of regular expressions you'll use 90% of the time. Note that for this reason we assume all strings to be single-line strings containing no newline chars.

What They Are

Regular expressions are a syntax, implemented in PERL and certain other environments, making it not only possible but easy to do some of the following:
  • Complex string comparisons
    • $string =~ m/sought_text/;    # m before the first slash is the "match" operator.
  • Complex string selections
    • $string =~ m/whatever(sought_text)whatever2/;
    • $soughtText = $1;
  • Complex string replacements
    • $string =~ tr/originaltext/newtext/;    # tr before first slash is "translate" operator.
  • Parsing based on the above abilities

Doing String Comparisons

We start with string comparisons because they're the easiest, and yet most of what's contained here is applicable in selecting and replacing text.

Simple String Comparisons

The most basic string comparison is
$string =~ m/sought_text/;
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$/;
Now, if you want the comparison to be true only if $string contains the sought text and nothing but the sought text, simply do this:
$string =~ m/^sought_text$/;
Now what if you want the comparison to be case insensitive? All you do is add the letter i after the ending delimiter:
$string =~ m/^sought_text$/i;

Using Simple "Wildcards" and "Repetitions"

Calling these "wildcards" may actually conflict with the theoretical grammer and syntax of PERL, but in fact is the most intuitive way to think of it, and will not lead to any coding mistakes.
.   Match any character
/w  Match "word" character (alphanumeric plus "_")
/W  Match non-word character
/s  Match whitespace character
/S  Match non-whitespace character
/d  Match digit character
/D  Match non-digit character
/t  Match tab
/n  Match newline
/r  Match return
/f  Match formfeed
/a  Match alarm (bell, beep, etc)
/e  Match escape
/021  Match octal char ( in this case 21 octal)
/xf0  Match hex char ( in this case f0 hexidecimal)
You can follow any character, wildcard, or series of characters and/or wildcard with a repetiton. Here's where you start getting some power:
*      Match 0 or more times
+      Match 1 or more times
?      Match 1 or 0 times
{n}    Match exactly n times
{n,}   Match at least n times
{n,m}  Match at least n but not more than m times
Now for some examples:
$string =~ m//s*rem/i;   #true if the first printable text is rem or REM
$string =~ m/^/S{1,8}/./S{0,3}/;   # check for DOS 8.3 filename 
                                   #  (note a few illegals can sneak thru)

Using Groups ( ) in Matching


Note: Many situations can be done either with groups ( ) or character classes [ ]. Groups are less quirky and they more often yield the results you were looking for. 
Groups are regular expression characters surrounded by parentheses. They have two major uses:
  1. To allow alternative phrases as in /(Clinton|Bush|Reagan)/i. Note that for single character alternatives, you can also use character classes.
  2. As a means of retrieving selected text in selection, translation and substitution, used with the $1, $2, etc scalers.
This section will discuss only the first use. To see more about the second use, click here.

Powerful regular expressions can be made with groups At its simplest, you can match either all lowercase or name case like this:

if($string =~ m/(B|b)ill (C|c)linton/)
  {print "It is Clinton, all right!/n"}
Detect all strings containing vowels
if($string =~ m/(A|E|I|O|U|Y|a|e|i|o|u|y)/)
  {print "String contains a vowel!/n"}
Detect if the line starts with any of the last three presidents:
if($string =~ m/^(Clinton|Bush|Reagan)/i)
  {print "$string/n"};
Note that the parenthesized element will appear as $1 statements that follow the regular expression. That's OK. If you don't want to use $1, just ignore it. The use of $1, etc, will be explained in the section on Doing String Selections.

Using Character Classes [ ]

Character classes are alternative single characters within square brackets, and are not to be confused with OOP classes, which are blueprints for objects. If not used carefully, they can yield unexpected results. Remember that groupsare an alternative.

Character classes have three main advantages:

  1. Shorthand notation, as [AEIOUY] instead of (A|E|I|O|U|Y). This advantage is minor at best.
  2. Character Ranges, such as [A-Z].
  3. One to one mapping from on class to another, as in tr/[a-z]/[A-Z]. This is essential! It will be discussed in the section on translations.

THE WHOLE THING IN THE SQUARE BRACKETS REPRESENTS EXACTLY ONE CHARACTER!!!

Did I shout loud enough? It may be tempting to do something like this:
if($string =~ /[Clinton|Bush|Reagan]/){$office = "President"}
The above may even appear to work upon casual testing. Don't do it. Remember that everything inside the brackets represents ONE character, simply listing all it's alternative possibilities.

Other Quirks

I haven't fully investigated this yet, but character classes seem to sometimes do goofy things in regular expressions where the case is ignored (i after the trailing delimiter).

Special Characters Inside the Square Brackets

As we've already seen, a hyphen is used to indicate all characters in the colating sequence between the character on the hyphen's left and the character on its right.

An uparrow (^) at immediately following the opening square bracket means "Anything but these characters", and effectively negates the character class. For instance, to match anything that is not a vowel, do this:

if($string =~ /[^AEIOUYaeiouy]/){print "This string contains a non-vowel"}
Contrast to this:
if($string !~ /[AEIOUYaeiouy]/){print "This string contains no vowels at all"}

Best Uses of Character Classes

Print all people whose name begins with A through E
if($string =~ m/^[A-E]/)
  {print "$string/n"}
If character classes are giving you quirky results, consider using groups!

Matching: Putting it All Together

Print everyone whose last name is Clinton, Bush or Reagan. Each element of list is first name, blank, last name, and possibly more blanks and more info after the last name. Study this til you understand it.
if($string =~ m/^/S+/s+(Clinton|Bush|Reagan)/i)
  {print "$string/n"};
Print every line with a valid phone number.
if($string =~ m/[/)/s/-]/d{3}-/d{4}[/s/./,/?]/)
  {print "Phone line: $string/n"};

Doing String Selections (Parsing)

If regular expressions' only benefit was looking for a (albeit complex) string within a string, it wouldn't be worth learningl. Regular expressions (and PERL itself, for that matter) really start earning their keep by allowing you to select and process substrings based on what they contain, and the context in which they appear.

For instance, create a program whose input is a piped in directory command and whose output is stdout, and whose output represents a batch file which copies every file (not directory) older than 12/22/97 to a directory called /oldie. This would be pretty nasty in C or C++. The directory output would look something like this:

 Volume in drive D has no label
 Volume Serial Number is 4547-15E0
 Directory of D:/polo/marco

.              <DIR>        12-18-97 11:14a .
..             <DIR>        12-18-97 11:14a ..
INDEX    HTM         3,237  02-06-98  3:12p index.htm
APPDEV   HTM         6,388  12-24-97  5:13p appdev.htm
NORM     HTM         5,297  12-24-97  5:13p norm.htm
IMAGES         <DIR>        12-18-97 11:14a images
TCBK     GIF           532  06-02-97  3:14p tcbk.gif
LSQL     HTM         5,027  12-24-97  5:13p lsql.htm
CRASHPRF HTM        11,403  12-24-97  5:13p crashprf.htm
WS_FTP   LOG         5,416  12-24-97  5:24p WS_FTP.LOG
FIBB     HTM        10,234  12-24-97  5:13p fibb.htm
MEMLEAK  HTM        19,736  12-24-97  5:13p memleak.htm
LITTPERL       <DIR>        02-06-98  1:58p littperl
         9 file(s)         67,270 bytes
         4 dir(s)     132,464,640 bytes free
UUUUgly! I'd hate to do this in C or C++. But wait. It's 18 lines in Perl?
while(<STDIN>)
  {
  my($line) = $_;
  chomp($line);
  if($line !~ /<DIR>/)         #directories don't count
    {
    #** only lines with dates at position 28 and (long) filename at pos 44 **
    if ($line =~ /.{28}(/d/d)-(/d/d)-(/d/d).{8}(.+)$/)
      {
      my($filename) = $4;
      my($yymmdd) = "$3$1$2";
      if($yymmdd lt "971222")
        {
        print "copy $filename //oldie/n"; 
        }
      }
    }
  }
Not bad for 18 lines of code. It could have been shorter, but I wanted to keep it readable. In the snippet above, $1, $2, $3 and $4 are the scalers inside the first, second, third and fourth parenthesis sets. The first three are re-assembled into a yymmdd date string which can be compared with the constant "971222". The fourth holds the filename which will be copied to the /oldie directory if it's not a directory, it's a line with a date, and the date is before 971222. This is the true power of regular expressions and PERL.

Now count the bytes in the directory:

my($totalBytes) = 0;
while(<STDIN>)
  {
  my($line) = $_;
  chomp($line);
  if($line !~ /<DIR>/)         #directories don't count
    {
    #*** only lines with dates at position 28 ****
    if ($line =~ /.{12}((/d| |,){14})  /d/d-/d/d-/d/d/)
      {
      my($bytes) = $1;
      $bytes =~ s/,//;         #substitute nothing for comma -- delete commas
      $totalBytes += $bytes;
      }
    }
  }
print "$totalBytes bytes in directory./n";
Note the group within a group, where the inner one is used for character alternation, and the outer is used as a selection.

Doing Substitutions

Replace every "Bill Clinton" with an "Al Gore"
$string =~ s/Bill Clinton/Al Gore/;
Now do it ignoring the case of bIlL ClInToN.
$string =~ s/Bill Clinton/Al Gore/i;

Doing Translations

Translations are like substitutions, except they happen on a letter by letter basis instead of substituting a single phrase for another single phrase. For instance, what if you wanted to make all vowels upper case:
$string =~ tr/[a,e,i,o,u,y]/[A,E,I,O,U,Y]/;
Change everything to upper case:
$string =~ tr/[a-z]/[A-Z]/;
Change everything to lower case
$string =~ tr/[A-Z]/[a-z]/;
Change all vowels to numbers to avoid "4 letter words" in a serial number.
$string =~ tr/[A,E,I,O,U,Y]/[1,2,3,4,5]/;

Greedy and Ungreedy Matching

Perl regular expressions normally match the longest string possible. For instance:
my($text) = "mississippi";
$text =~ m/(i.*s)/;
print $1 . "/n";
Run the preceding code, and here's what you get:
ississ
It matches the first i, the last s, and everything in between them. But what if you want to match the first i to the s most closely following it? Use this code:
my($text) = "mississippi";
$text =~ m/(i.*?s)/;
print $1 . "/n";
Now look what the code produces:
is
Clearly, the use of the question mark makes the match ungreedy. But theres another problem in that regular expressions always try to match as early as possible. Read on...

Resolving Doubledots in A Filepath

Doubledots are placefillers for "go up one directory" in a file path. Typically, when you desire to create an absolute path, you want to resolve them by deleting them and the level of directory above them. For instance, /a/b/../whatever becomes /a/whatever.

This is MUCH trickier than it might seem. It's likely that all your ideas about greedy matching, replacement strings and the like won't work. Here's the regular expression to resolve A SINGLE double dot:

$text =~ s///[^//]*///././/;
In English, this says "find a slash, followed by any number of nonslashes, followed by a slash, followed by two dots, and replace them with nothing. This technique will resolve doubledots in a string as long as that string has only one doubledot. But the plot thickens...

Doubledots can occur alternatively with directories (/a/b/../c/../d) or nested (/a/b/c/../../d). The best way I've found to reliably resolve all doubledots is to make a function that loops through the preceding regular expression until there are no more doubledots. Here's the function:

sub deleteDoubleDots($)
        {
        while($_[0] =~ m//././)
                {
                $_[0] =~ s///[^//]*///././/;
                }
        }
The preceding function will resolve all doubledots, be they alternating or nested, or combinations thereof.

Kewl Splitpath One Liner Regex

Check out this splitpath command:
my($text) = "/etc/sysconfig/network-scripts/ifcfg-eth0";
my($directory, $filename) = $text =~ m/(.*//)(.*)$/;
print "D=$directory, F=$filename/n";
Is that cool or what?

Using a Variable as a Match Expression

You can use a variable inside the match expression. This yields tremendous power. Simply place the variable name between the forward slashes, and the expression will be sought in the string. Here's an example:

#!/usr/bin/perl -w
# use strict;

sub test($$)
{
my $lookfor = shift;
my $string = shift;
print "/n$lookfor ";
if($string =~ m/($lookfor)/)
{
print " is in ";
}
else
{
print " is NOT in ";
}
print "$string.";
if(defined($1))
{
print " <$1>";
}
print "/n";
}

test("st.v.", "steve was here");
test("st.v.", "kitchen stove");
test("st.v.", "kitchen store");

The preceding code produces the following output.

[slitt@mydesk slitt]$ ./junk.pl

st.v. is in steve was here. <steve>

st.v. is in kitchen stove. <stove>

st.v. is NOT in kitchen store.
[slitt@mydesk slitt]$

As you can see, you can seek a regex expression stored in a variable, and you can retrieve the result in $1.

Symbol Explanations:

=~

This operator appears between the string var you are comparing, and the regular expression you're looking for (note that in selection or substitution a regular expression operates on the string var rather than comparing). Here's a simple example:

$string =~ m/Bill Clinton/;               #return true if var $string contains the name of the president
$string =~ tr/Bill Clinton/Al Gore/;  #replace the president with the vice president

!~

Just like =~, except negated. With matching, returns true if it DOESN'T match. I can't imagine what it would do in translates, etc.

/

This is the usual delimiter for the text part of a regular expression. If the sought-after text contains slashes, it's sometimes easier to use pipe symbols (|) for delimiters, but this is rare. Here are simple examples:

$string =~ m/Bill Clinton/;               #return true if var $string contains the name of the president
$string =~ tr/Bill Clinton/Al Gore/;  #replace the president with the vice president

m

The match operator. Coming before the opening delimiter, this is the "match" operator. It means read the string expression on the left of the =~, and see if any part of it matches the expression within the delimiters following the m. Note that if the delimiters are slashes (which is the normal state of affairs), the m is optional and often not included. Whether it's there or not, it's still a match operation. Here are some examples:

$string =~ m/Bill Clinton/;            #return true if var $string contains the name of the president
$string =~ /Bill Clinton/;               #same result as previous statement

^

This is the "beginning of line" symbol. When used immediately after the starting delimiter, it signifies "at the beginning of the line". For instance:

$string =~ m/^Bill Clinton/;            #true only when "Bill Clinton" is the first text in the string

$

This is the "end of line" symbol. When used immediately before the ending delimiter, it signifies "at the end of the line". For instance:

$string =~ m/Bill Clinton$/;            #true only when "Bill Clinton" is the last text in the string

i

This is the "case insensitivity" operator when used immediately after the closing delimiter. For instance:

$string =~ m/Bill Clinton/i;            #true when $string contains "Bill Clinton" or BilL ClInToN"

手把手教你使用Segformer训练自己的数据 SegFormer 基于Swin transformer 修改 阅读详情

相关推荐

从混乱到清晰:用QJsonObject重构你的Qt网络API数据解析层(避坑指南)

本文详细介绍了如何使用QJsonObject重构Qt网络API数据解析层,避免常见的JSON解析陷阱。通过安全解析模式、数据绑定和性能优化技巧,帮助开发者构建高效、健壮的解析逻辑,提升代码可维护性和可读性。特别适用于处理复杂嵌套的JSON响应数据场景。

weixin_29011667的博客 233

Perl 正则表达式

Jmeter接口测试

liuqinhou的博客 1390

标准化降水指数介绍

Mckee et al.(1993)认为降水量的减少是导致干旱的主要因素,其他气候因子一般变化较小,对干旱产生的影响不大,因此SPI使用降水量作为唯一参数。SPI能较好表达因降水量的大小反映干旱状况,操作简单,所需资料仅为降水量,同时该干旱指数在各个地区和各个时段都具有良好的计算稳定性,是继PDSI之后另一种被广泛应用的干旱指数。𝐻(𝑥)是Γ分布求得的概率,并当𝐻(𝑥)>0.5时,S=1;式中,𝛼是形状参数,𝛽是尺度参数,𝑥是当月降水量,𝛤(𝛼)是Gamma函数,用极大似然估计法计算最佳的𝛼和𝛽,即。

weixin_44259522的博客 2863

Perl教学 第六篇 模式匹配

一、简介模式指在字符串中寻找的特定序列的字符,由反斜线包含:/def/即模式def。其用法如结合函数split将字符串用某模式分成多个单词:@array = split(/ /, $line);二、匹配操作符 =~、!~=~检验匹配是否成功:$result = $var =~ /abc/;若在该字符串中找到了该模式,则返回非零值,即true,不匹配则返回0,即false。!~则相反。这两个操作符适

Hank_Huang的专栏 1438

蓝桥杯算法:打印图形——六芒星

【输入格式】 输入一行包含一个整数 n。 【输出格式】 输出一个六芒星,表示满足题意的图形。 【样例输入】 3 4 【样例输出】 【评测用例规模与约定】 对于所有评测用例,1 ≤ n ≤ 20。 总结: 第一次做图形题,做了蛮久,图形题有很多的方式去完成,它考验的是你能不能找到更简单的那一种方式. 我初看到这个图形,第一种想法是把这个六芒星当做六个小三角形来做,然后以某种规则排列一下,就能做出来,但是尝试了一下感觉太麻烦了。 然后我的第二种想法是,这个图形是对称图形,怎么能写出一半吗? 这样另一半想办

KeepCodeing 3844

DeepSeek 在 PostgreSQL 中,执行 `DELETE` 操作后,数据占用的空间并不会立即释放给操作系统

操作后,数据占用的空间并不会立即释放给操作系统。这是 PostgreSQL 的 MVCC(多版本并发控制)机制决定的——删除的数据只是被标记为“死元组”,物理空间仍然被表占用。这是最彻底的释放方式,会将表重写为一个没有空洞的新文件,将空间返回给操作系统。如果你的表非常大(如几百GB),或者这是生产环境的核心表,建议优先考虑。你可以告诉我你的表大概多大、是否能接受锁表,我可以给你更精确的建议。要真正释放空间,需要根据你的实际需求,从以下三种方案中选择一种。如果你既想彻底释放空间,又无法接受锁表,

m0_37843156的博客 412

Perl 中的正则表达式

正则表达式是 Perl 语言的一大特色,也是 Perl 程序中的一点难点,不过如果大家能够很好的掌握他,就可以轻易地用正则表达式来完成字符串处理的任务,当然在 CGI 程序设计中就更能得心应手了。下面我们列出一些正则表达式书写时的一些基本语法规则。 1 正则表达式的三种形式 首先我们应该知道 Perl 程序中,正则表达式有三种存在形式,他们分别是: 匹配:m/&...

weixin_34101229的博客 266

(10)Proteus 8.9上的STM32仿真系列(HAL)---freertos

实验设计:通过cubemxide生成freertos工程,然后创建一个 pc13 led灯间隔200ms闪烁的任务。非常遗憾的是proteus8.9仿真失败,实物上没有问题,但还是把流程过一遍。 一、原理图 实物是淘宝上stm32f103 c8t6的核心板,proteus上没有这个芯片,这里图上大概表示一下,用的是核心板自带的pc13引脚的led灯。 二、cubemxide配置 1.RCC如之前工程一样配置 2、配置SYS timebase Source不要使用systick,自己选择一个定时器,我这

qq_35442550的博客 7350

Perl:正则表达式

本文介绍了Perl语言中正则表达式的基本概念和使用方法。正则表达式起源于20世纪50年代,由数学家Stephen Kleene提出概念,后经UNIX开发者Kenneth Thompson应用于文本处理工具。Perl语言(Larry Wall发明)进一步强化了正则表达式功能,使其成为Perl的核心特性之一。 文章详细讲解了Perl正则表达式的三大功能:匹配(match)、捕获(capture)和替换(replace)。

保持终身学习的能力,温故而知新 2137

基于加速科技ST2500的SN74HC00N芯片测试计划

实际上随着工艺的进步,器件内部和引脚间的绝缘氧化膜越来越薄,导致漏电流发生的概率更大,另外制造过程中的工艺缺陷导致的桥接,异物或封装过程中造成的芯片划伤、引裂,都会造成IC的漏电流偏大,有部分产品可能会表现出漏电流偏大,但功能正常,此类产品具有潜在的可靠性问题,漏电流测试的目的就是把具有此类缺陷的产品筛选出来,避免其流到最终产品造成更大的损失。漏电流的测试方法相对简单,就是根据产品手册或测试规范对被测引脚施加额定的电压,然后测量其输入或流出的电流是否符合相应的设计规范。74HC00引脚功能如表所示。

weixin_68288412的博客 1445

RK3568笔记九十四:基于QT的YOLOV5目标检测

基于RK3568平台的实时目标检测应用,使用YOLOv5模型和RKNN推理引擎实现摄像头实时目标检测,并通过Qt界面显示检测结果。主要功能实时摄像头目标检测:从摄像头获取视频流,使用YOLOv5模型进行目标检测RKNN推理加速:利用RK3568内置的NPU进行模型推理加速图形界面显示:使用Qt框架构建用户界面,实时显示检测结果RGA图像处理:使用Rockchip Graphic Accelerator进行图像缩放处理。

529

Linux命令中正则表达式的运用

linux的命令行可以胜任所有的工作,这和ms的产品有着很大的区别,到现在为止仍然有很多的爱好者对敲键盘乐此不疲,而在繁重的管理工作和键盘工作中,正则表达式对于简化工作起到了很大的作用。 Perl regular expressions man page.http://www.perldoc.com/perl5.8.0/pod/perlre.html一、正则表达式简介 事实上,正则

Penglunyan 819

基于PCL的电力线点云提取与分割实现

本文基于PCL库实现电力线点云提取与分割,包含6个核心处理阶段:文件读取与结果文件夹创建、高程滤波分割候选点云、欧式聚类去噪、电力线分段提取、球形邻域搜索补全点云、最终分割与可视化保存。通过PCA计算点云线性特征(阈值0.91)筛选电力线点,采用欧式聚类(容忍度3.0)去除噪点,并针对不同规模聚类差异化设置球形搜索半径(4.0/6.0)补全点云。最终通过欧式聚类分割并可视化带颜色点云。算法对高程滤波阈值、聚类参数等具有敏感性,需根据点云特性调整优化。

weixin_45196569的博客 199

PCRE - Perl Compatible Regular Expressions

The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, as well as a set of wrapper functi

tuzi37的专栏 1910

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Regular expressions in Perl

http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word Regular expression to match string not containing a word? http://www.cs.tut.fi/~jkorp

princess9的专栏 407

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Perl regular expressions tutorial - 7 (Using regular expressions in Perl)

The last topic of Part 1 briefly covers how regexps are used in Perl programs. Where do they fit into Perl syntax?We have already introduced the matching operator in its default /regexp/ and arbit

505

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Perl-regular expressions

[align=center][size=large][b]Perl-regular expressions[/b][/size][/align] [size=large][b] 正则表达式:[/b][/size] * 正则表达式的三种形式 * 正则表达式中的常用模式 * 正则表达式的 8 大原则 [size=large][b]1. 正则...

android菜鸟的专栏 205

Perl Regular Expressions by Example

Introduction Regular expressions are very powerful tools for matching, searching, and replacing text. Unfortunately, they are also very obtuse. It does not help that most explanations of regular expr...

weixin_30861459的博客 95

PCRE - Perl-compatible regular expressions

lighttpd的源码中,keyvalue这个数据结构用到了pcre库。之前没见过, google之后发现是一个正则表达式的库,顺便简单了解了一下使用方法。 关于PCRE库的介绍和使用方法可以看手册PCRE(3),PCRE的源码里 附带了一个pcredemo.c,里面注释很详细了,看完应该就会用了。 其实最简单的使用只需要知道两个函数(man pcreapi):

Chaos 989

SAS Perl Regular Expression and SAS Regular Expressions (2)

可以先参考先前介绍正则表达式的元字符的那篇。 SAS对正则表达式 (Regular Expressions, RX) 的支持,表现在以下两大类函数(包括Call Routines)中: SAS Perl Regular Expressions (PRX),SAS9开始引进,有10个函数; SAS Regular Expressions (RX) ,SAS6.12就开始支持,5个函

数据挖掘与科学计算:学习笔记 1753

PCRE Perl Compatible Regular Expressions Learning

catalog 1. PCRE Introduction 2. pcre2api 3. pcre2jit 4. PCRE Programing 1. PCRE Introduction The PCRE library is a set of functions that implement regular expression pattern matching usin...

weixin_30408165的博客 157

Perl 学习手札之九:regular expressions

Perl 学习手札之九:regular expressions Regular expressions is a very powerful method of matching patterns in text   there are often called "regex" or the plural "regexes". they a...

weixin_34168880的博客 160

Perl regular expressions tutorial - 14 (Conditional expressions)

A conditional expression  is a form of if-then-else statement that allows one to choose which patterns are to be matched, based on some condition. There are two types of conditional expression: (?(co

539
上一篇: Perl正则表达式讲解
下一篇: MD5算法研究(中文的哦)
freexploit
博客等级 码龄22年 315粉丝 778原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址