点击数:1736
简介:
PCRE(Perl Compatible Regular Expressions中文含义:perl语言兼容正则表达式)是一个用C语言编写的正则表达式函数库,由菲利普.海泽(Philip Hazel)编写。PCRE是一个轻量级的函数库,比Boost之类的正则表达式库小得多。PCRE十分易用,同时功能也很强大,性能超过了POSIX正则表达式库和一些经典的正则表达式库 。
和Boost正则表达式库的比较显示 ,双方的性能相差无几,PCRE在匹配简单字符串时更快,Boost则在匹配较长字符串时胜出—但两者差距很小,考虑到PCRE的大小和易用性,我们可以认为PCRE更值得考虑。
PCRE被广泛使用在许多开源软件之中,最著名的莫过于Apache HTTP服务器和PHP脚本语言、R脚本语言,此外,正如从其名字所能看到的,PCRE也是perl语言的缺省正则库。
PCRE是用C语言实现的,其C++实现版本是PCRE++。
版本说明:
There are two major versions of the PCRE library. The current version, PCRE2, first released in 2015, is now at version 10.35.
The older, but still widely deployed PCRE library, originally released in 1997, is at version 8.44. Its API and feature set are stable—future releases will be for bugfixes only. Any new features will be added to PCRE2, and not to the PCRE 8.x series.
安装前的准备
1.检查系统中是否默认安装pcre
rpm -qa | grep pcre
2. 如果安装有pcre,可以删除自带的pcre,
注意:删除之前,先查看一下自己的系统是否存在libpcre.so.1,如果有先备份一下。避免由于pcre的关联问题,导致后续pcre安装不上
错误可能如下:
grep: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
或者
ImportError: libpcre.so.1: cannot open shared object file: No such file or directory
执行命令:
find / -name “libpcre.so.1” //查找“libpcre.so.1”所存在的位置

将该目录放到/etc/ld.so.conf下,并使之生效,执行命令如下:
echo “/usr/local/lib” >>/etc/ld.so.conf
ldconfig
备份libpcre.so.1,命令如下:
cp /usr/local/lib/libpcre.so.1 /
根据查询出的pcre版本,删除指定的版本:
rpm -e –nodeps pcre-8.42-4.el8.x86_64
安装方法一,手动源码指定版本编译安装步骤:
1. 下载pcre 8.44版本
官网无法下载或者下载慢的话,可以从以下地址下载相应的pcre文件并上传到你的服务器,并进行后续的操作
http://download.jiyaoge.com/dir/25806543-41266747-36abf7
其他地址下载:
pcre编译安装包,wget ftp://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
pcre2的获取地址为:wget ftp://ftp.pcre.org/pub/pcre/pcre2-10.35.tar.gz
2. 解压缩
tar -zxvf pcre-8.44.tar.gz
3. 配置并安装到指定位置
cd pcre-8.44
./configure –prefix=/data/install/pcre –libdir=/usr/local/lib/pcre –includedir=/usr/local/include/pcre
configure有许多参数可配,具体参见./configure –help及手册
注意:当配置pcre的时候,因为PCRE是一个库,而不是像 Apache, PHP, KDE, Postfix, and Nmap等这样的程序,所以我们安装时选择默认路径即可,只需./configure,不需要带任何参数,这样会在后面安装其它东西时避免一些不必要的麻烦,各人根据自己的喜好来进行即可

4. 编译安装
make&make install

5. 使用ls命令检查上述第3步指定的配置参数的内容是否存在
6. 检查是否安装完好
pcregrep -V

至此全部完成pcre的安装。
安装方法二:
使用centos的yum命令直接安装
yum -y install pcre pcre-devel
best dissertation writing service review https://helpon-doctoral-dissertations.net/
dissertation uf https://dissertations-writing.org/
master dissertation writing services https://mydissertationwritinghelp.com/
nursing dissertation writing service https://help-with-dissertations.com/
dissertation writing services illegal https://dissertationwriting-service.com/
writing dissertation and grant proposals https://buydissertationhelp.com/
free slots to play online https://411slotmachine.com/
play free slots for fun https://beat-slot-machines.com/
vegas online slots https://slot-machine-sale.com/
bier haus slots https://slotmachinesforum.net/
free slots video poker https://slotmachinesworld.com/
slots with high volitality https://pennyslotmachines.org/
triple diamond slots https://candylandslotmachine.com/
free play slots online https://freeonlneslotmachine.com/
100% free slots games https://2-free-slots.com/
2heartache