pcre

亚马逊AWS服务器CentOS/Linux系统Shell安装Nginx及配置自启动

馋奶兔 提交于 2019-12-26 20:25:21
领了一个亚马逊的1年免费服务器,今天尝试安装 Nginx 服务器,使用原生的 Shell 方法。 为了方便以后查看,就把过程记录一下。 注意:亚马逊(AWS)服务器默认只能用 user-ec2 账户进行登陆,需要切换一下,使用 root 账户登陆。否则会因为权限不够,导致一些软件或功能无法安装。 参考我之前的文章: 使用Xshell登录亚马逊AWS EC2服务器&配置root+密码方式登录 系统平台: Amazon Linux 2 AMI (HVM) 安装步骤: 一、安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 二、首先要安装 PCRE PCRE 作用是让 Nginx 支持 Rewrite 功能。 注:需要按步骤一步一步操作,特别注意目录。 1、下载 PCRE 安装包 : 插:这里可能会提示 -bash: wget: command not found 需要 安装 wget 下载工具:若已安装,直接跳过即可 yum -y install wget 安装完成即可继续操作。 下载 PCRE 安装包,下载地址: https://pilotfiber.dl.sourceforge.net/project/pcre/pcre/8.43/pcre-8.43.tar.gz

nginx离线安装安装

故事扮演 提交于 2019-12-26 00:39:53
1 --先安装PCRE作用是让Nginx支持重写功能。 下载PCRE安装包,下载地址: http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz http://www.pcre.org/ tar -zxvf pcre-8.38.tar.gz cd pcre-8.38 ./configure --prefix=/app/pcressl/pcre-8.38 #make && make install 报错:configure: error: You need a C++ compiler for C++ support 需要安装: yum install -y gcc gcc-c++ 2 --安装 openssl openssl-1.0.2n.tar 强大的安全套接字层密码库 tar -xvf openssl-1.0.2n.tar cd openssl-1.0.2n ./config --prefix=/app/pcressl/openssl-1.0.2n # make && make install 3.--安装zlib 为的是解包gzip http://www.zlib.net/ tar -xvf zlib-1.2.11.tar cd zlib-1.2.11 ./configure -

Large regex patterns: PCRC won't do it

馋奶兔 提交于 2019-12-25 06:44:49
问题 I have a long list of words that I want to search for in a large string. There are about 500 words and the string is usually around 500K in size. PCRE throws an error saying preg_match_all: Compilation failed: regular expression is too large at offset 704416 Is there an alternative to this? I know I can recompile PCRE with a higher internal linkage size, but I want to avoid messing around with server packages. 回答1: Could you approach the problem from the other direction? Use regex to clean up

Recursive PCRE search with patterns

房东的猫 提交于 2019-12-25 04:46:07
问题 This question has to do with PCRE . I have seen a recursive search for nested parentheses used with this construct: \(((?>[^()]+)|(?R))*\) The problem with this is that, while the ' [^()]+ ' can match any character including newline, you are forced to match only single-character characters, such as braces, brackets, punctuation, single letters, etc. What I am trying to do is replace the '(' and ')' characters with ANY kind of pattern (keywords such as 'BEGIN' and 'END', for example). I have

Is the PCRE library thread-safe? If not, which do you recommend?

断了今生、忘了曾经 提交于 2019-12-24 22:10:49
问题 For C/C++, is the PCRE library thread-safe? If PCRE is thread-safe, is there any problem in performance? 回答1: Judging from the PCRE documentation: MULTITHREADING The PCRE functions can be used in multi-threading applications, with the proviso that the memory management functions pointed to by pcre_malloc, pcre_free, pcre_stack_malloc, and pcre_stack_free, and the callout and stack-checking functions pointed to by pcre_callout and pcre_stack_guard, are shared by all threads. The compiled form

Match or remove string that occurs multiple times within two strings with regex

和自甴很熟 提交于 2019-12-24 16:26:28
问题 I have a large csv export where the columns do not align because some values are accidentally put in multiple cells instead of one. Fortunately, the values lay between two unique strings. I am hoping to use regex to merge these values into one cell. Sample data is as follows: "apple","NULL","0","0","0",",","1",",","fruit","red","sweet","D$","object" "horse","NULL","0","0","0",",","1",",","animal","large","tail","D$","object" "Los Angeles","NULL","0","0","0",",","1",","city","California",

Convert Javascript Regular Expression to PHP (PCRE) Expression

本小妞迷上赌 提交于 2019-12-24 16:21:00
问题 I am up to my neck in regular expressions, and I have this regular expression that works in javascript (and flash) that I just can't get working in PHP Here it is: var number = '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)'; var oneChar = '(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]' + '|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))'; var str = '(?:\"' + oneChar + '*\")'; var varName = '\\$(?:' + oneChar + '[^ ,]*)'; var func = '(?:{[ ]*' + oneChar + '[^ ]*)'; // Will match a value in a

PCRE Encoding Support

天涯浪子 提交于 2019-12-24 12:24:29
问题 I saw in the PCRE Documentation that PCRE support UTF-8 and Unicode general category properties, but i dont see where it say the Native encoding support. If you say that support ISO-8859-1: where can i found info about that? In A Nutshell: Ive compared & im guessing that the encoding supported by PHP is windows-1252 and not the ISO-8859-1 encoding. if(preg_match('/€/',"\x80")) echo "Match"; ISO-8859-1 doesn't have the '€' in that position. Windows-1252 does. Or dependes of the system? So wich

Help using PCRE in C++

一笑奈何 提交于 2019-12-24 09:32:38
问题 this is my first time trying to build a C++ application, so I'm kind of lost. I've looked at some examples but I still dont really know what's wrong. #include <iostream> #include <stdio.h> #include <windows.h> #include <pcrecpp.h> #include <string> #include <cstring> using namespace std; int main() { char title[256]; char url[256]; string song, diff; HWND hwnd = FindWindow("WindowsForms10.Window.8.app.0.33c0d9d", NULL); GetWindowTextA(hwnd, title, 255); pcrecpp::RE re("^osu! - (.*) \\[(.*)\\]

PCRECPP (pcre) extract hostname from url code problem

╄→尐↘猪︶ㄣ 提交于 2019-12-24 03:39:13
问题 I have this simple piece of code in c++: int main(void) { string text = "http://www.amazon.com"; string a,b,c,d,e,f; pcrecpp::RE re("^((\\w+):\\/\\/\\/?)?((\\w+):?(\\w+)?@)?([^\\/\\?:]+):?(\\d+)?(\\/?[^\\?#;\\|]+)?([;\\|])?([^\\?#]+)?\\??([^#]+)?#?(\\w*)"); if(re.PartialMatch(text, &a,&b,&c,&d,&e,&f)) { std::cout << "match: " << f << "\n"; // should print "www.amazon.com" }else{ std::cout << "no match. \n"; } return 0; } When I run this it doesn't find a match. I pretty sure that the regex