pcre

ANTLR PCRE Grammar to JS Target

二次信任 提交于 2019-12-19 11:04:26
问题 I'm trying to build Bart Kiers' ANTLR PCRE grammar (see: http://big-o.nl/apps/pcreparser/pcre/PCREParser.html) to a JS target. The only way I get get it to build is with global backtracking and memoization and it's generating code that is invalid here is the grammar: grammar PCRE; options { language=JavaScript; backtrack=true; memoize=true; } parse : regexAtom* EOF ; ... and the rest of the grammar as seen: http://big-o.nl/apps/pcreparser/pcre/PCREParser.html The lexer is generating code that

Nginx(二):Nginx基本安装

南楼画角 提交于 2019-12-19 09:57:23
基于Linux安装 环境准备 CentOS7 Nginx1.9 gcc gcc-c++ PCRE库 OpenSSL库 zlib库 基本安装 1.安装gcc gcc-c++ 安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境 $ yum install -y gcc gcc-c++ 2.安装wget(如未安装,请先安装) $ yum -y install wget 3.安装PCRE库 PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。 $ cd /usr/local/ $ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz $ tar -zxvf pcre-8.33.tar.gz $ cd pcre-8.33 $ ./configure $ make && make install 4.安装OpenSSL库 OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及

Recursive/subroutine regex to match CSS media queries

浪尽此生 提交于 2019-12-19 04:23:18
问题 I'm looking for a regular expression (in PHP PCRE) that can match media queries and their contents reliably, including the somewhat odd case where a media query body is empty. Source text might be: @media only screen { p { color:red; } } @media only screen and (max-width: 596px) { p { color:blue; } img { max-width: 200px; } } @media only screen { } img { display: block; } @media only screen and (max-width: 240px) { p { color:green; } } p { font-weight: normal; } I want to capture each media

Simulating LIKE in PHP

一笑奈何 提交于 2019-12-19 03:07:18
问题 Is there a way to simulate the LIKE operator of SQL in PHP with the same syntax? ( % and _ wildcards and a generic $escape escape character)? So that having: $value LIKE $string ESCAPE $escape you can have a function that returns the PHP evaluation of that without using the database? (consider that the $value , $string and $escape values are already set). 回答1: OK, after much fun and games here's what I have come up with: function preg_sql_like ($input, $pattern, $escape = '\\') { // Split the

linux环境nginx的安装与使用

我只是一个虾纸丫 提交于 2019-12-18 14:29:43
因为公司需要需要安装一系列环境,新手上路第一次配的时候什么也不懂在网上找了半天,觉得这篇不错,我在这里顺便记录一下。 (原文: https://www.cnblogs.com/wyd168/p/6636529.html ) 先复制过来,等有时间了在总结一下自己的方法...... 环境:CentOS-7 ( 以下环境搭建需要安装的建议安装其最新版或者当前最稳定版本!!!! ) -----------------------这是个轮子!!!!!! ----------------------- 开始前,请确认gcc g++开发类库是否装好,默认已经安装。   ububtu平台编译环境可以使用以下指令 apt-get install build-essential apt-get install libtool   centos平台编译环境使用如下指令   安装make: yum -y install gcc automake autoconf libtool make   安装g++: yum install gcc gcc-c++ 下面正式开始: 一、选定安装文件目录   可以选择任何目录,本文选择 cd /usr/local/src cd /usr/local/src 二、安装PCRE库   ftp://ftp.csx.cam.ac.uk/pub/software

Cannot --enable-pcregrep-libbz2 because bzlib.h was not found [closed]

允我心安 提交于 2019-12-18 13:22:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am trying to install pcre 8.32. When I tried to install following this tutorial I get this error: **Cannot --enable-pcregrep-libbz2 because bzlib.h was not found**. Then I tried: sudo yum install libbz2-dev and now it is saying No package libbz2-dev available.Error: Nothing to do I am totally confused. What

Regular expression that matches between quotes, containing escaped quotes

我是研究僧i 提交于 2019-12-18 10:57:09
问题 This was originally a question I wanted to ask, but while researching the details for the question I found the solution and thought it may be of interest to others. In Apache, the full request is in double quotes and any quotes inside are always escaped with a backslash: 1.2.3.4 - - [15/Apr/2005:20:35:37 +0200] "GET /\" foo=bat\" HTTP/1.0" 400 299 "-" "-" "-" I'm trying to construct a regex which matches all distinct fields. My current solution always stops on the first quote after the GET /

【Linux】Linux上安装Nginx

安稳与你 提交于 2019-12-18 10:53:32
本文介绍Linux环境安装Nginx,这里用的Linux系统是CentOS 7.2. 1. 从Nginx官网下载Nginx。这里用的版本为:1.13.6. 2. 将下载下来的Nginx上传到Linux上,这里以/opt/nginx目录为例。运行“ tar -zxvf nginx-1.13.6.tar.gz ”进行解压。 3. 切换到/opt/nginx/nginx-1.13.6目录下,运行./configure进行初始化配置。如出现下面的提示,说明该机器没有安装PCRE,而Nginx需要依赖PCRE,需要手动安装PCRE,见 http://www.linuxidc.com/Linux/2015-03/114986.htm 。 安装 pcre : PCRE(Perl Compatible Regular Expressions)是一个轻量级的Perl函数库,包括 perl 兼容的正则表达式库。它比Boost之类的正则表达式库小得多。PCRE十分易用,同时功能也很强大,性能超过了POSIX正则表达式库和一些经典的正则表达式库。 1. 先到此 https://sourceforge.net/projects/pcre/files/pcre/ 下载pcre,这里下载的版本是8.40. 2. 将pcre-8.40.tar.gz上传到/opt/pcre目录下,运行“ tar -zxvf

Apache installation; libpcre error

风格不统一 提交于 2019-12-18 10:26:53
问题 When installing Apache on Ubuntu 11.10, I get the following error: configure: error: APR not found. Please read the documentation. I followed the instructions here, then, I get the error below: configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ What am I doing wrong and how can I resolve it? 回答1: 1. Download PCRE from PCRE.org 2. Compile it with a prefix and install it: ./configure --prefix=/usr/local/pcre make make install 3. Go back to

Nginx安装

 ̄綄美尐妖づ 提交于 2019-12-18 07:07:35
nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。 ububtu平台编译环境可以使用以下指令 apt-get install build-essential apt-get install libtool centos平台编译环境使用如下指令 安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc-c++ 下面正式开始 一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。 1.选定源码目录 可以是任何目录,本文选定的是/usr/local/src cd /usr/local/src 2.安装PCRE库 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包: cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz tar -zxvf pcre-8.34