Questions tagged [pcre]

Perl Compatible Regular Expressions(PCRE) was initially developed as a regex engine for PERL, but grew into a library that many other languages (like PHP and Apache) use for their regex. Use with the [regex] tag and any appropriate language tags.

PCRE is an initialism for Perl Compatible Regular Expressions. It is both name of a flavor and the library that implements it and makes it available for use by other programs (e.g. , ).

Despite being designed with compatibility in mind, are not 100% compatible with regular expressions (). PCRE passes many of Perl’s regression tests, though. Comparison can be found in community-authored article on Wikipedia, as suggested by PCRE homepage.

Since POSIX regex deprecation in PHP 5.3, PCRE is PHP’s only supported regex engine.

References

2401 questions
1
vote
3 answers

Is it possible for C/C++ PCRE to match 2 or more UTF-8 codepoints which are far apart from each other in a UTF-8 String?

Good afternoon, We are using the latest C/C++ version of PCRE on WINDOWS Visual Studio 8.0 and 9.0 with PCRE_CASELESS, PCRE_UTF8, PCRE_UCP. When we use the PCRE regex [\x{00E4}]{1} we are able to match Standard Latin code point U+00E4 with the…
Frank
  • 1,406
  • 2
  • 16
  • 42
1
vote
1 answer

Ubuntu 12.04 - Error encountered in compiling PCRE

I am using Ubuntu 12.04 and I am trying to install pcre. However I encountered an error message when I tried to use the command: sudo make after the ./configure command. I have this error message: /bin/sed: can't read…
dimas
  • 2,487
  • 6
  • 40
  • 66
1
vote
2 answers

regex explained in english

I have looked here and from what I understand the following regex simply means "any unicode character sequence". Can someone confirm this please? Current Regex: /^(?>\P{M}\p{M}*)+$/u Also if I read the manual it says a) \P{M} = \PM b) (?>\PM\pM*) =…
Paul de Lange
  • 10,613
  • 10
  • 41
  • 56
1
vote
1 answer

Extracting the multiple line pattern SED or AWK

Hope the sed or awk gurus can help me out. I need to match a multiple line pattern in which the pattern range can span from one to three lines. I am not able to arrive at the result using pcregrep! The pattern I want to realise goes somewhat like…
Gil
  • 1,518
  • 4
  • 16
  • 32
1
vote
2 answers

Regular expression to find in which column a string exists

I am trying to determine in which column the name "Phone" appears, by checking the HTML of a web page. The string in which I am doing the search looks like this : Name Address ... ... < some more columns, but…
Wartin
  • 1,965
  • 5
  • 25
  • 40
1
vote
3 answers

What is cppcheck rule-file syntax?

I've poked around for a while, and can't find this anywhere. I have found a nice example of a cppcheck rule-file that shows a simple pattern; if \( p \) { free \( p \) ; }
CAB
  • 1,015
  • 1
  • 14
  • 24
1
vote
0 answers

How to clean PCRE old versions

Something wrong with the PCRE6.6.6 so I was told to upgrade. After I compiled and installed PCRE8.30, the latest version. My problem still existed. Now I was told to install 8.13 version. Actually, I found a yum source so I was about to install…
Hao
  • 6,291
  • 9
  • 39
  • 88
1
vote
2 answers

PHP calls '>' unknown modifer in regular expression? ( Delimiter issue )

private function pageScrape( $url ) { $page_stream = file_get_contents( $url ); $pattern = '/]*rel="(?:[Ss]hortcut\s)?[Ii]con"\s+)(?:[^>]*href="(.+?)").*/>/'; preg_match( $pattern, $page_stream, $matches ); print_r(…
user656925
1
vote
2 answers

preg_match kills page

I am using preg_match to find and remove evaled base64 encoded viruses within files. the regex bewlow: /\s*eval\s*\(\s*base64_decode\s*\(\s*('[a-zA-Z0-9\+\/]*={0,2}'|"[a-zA-Z0-9\+\/]*={0,2}")\s*\)\s*\s*\)\s*(;)?\s*/ matches the following…
Mihai Stancu
  • 15,848
  • 2
  • 33
  • 51
1
vote
3 answers

Regex for moving periods at end of sentences not abbreviations

Looking for some ideas on how to remove the period character in sentences but not remove the periods in abbreviations. For instance "The N.J. turnpike is long. Today is a beautiful day." Would be changed to: "The N.J. turnpike is long Today is a…
chrislovecnm
  • 2,549
  • 3
  • 20
  • 36
1
vote
6 answers

Stack overflow in IIRF (a C program, ISAPI)

I am using IIRF - an ISAPI rewrite filter for pretty URL's. I haven't been able to get much help from the developer on these issues. I'm hoping by making some sense of this dump, so I can find the problematic area in the code and rebuild it myself.…
MaseBase
  • 800
  • 3
  • 8
  • 31
1
vote
1 answer

Pcrecpp multiple lines

I'm using pcrecpp to match and expression in my C++ program. The relevant code is: pcrecpp::RE("GET (\n*|.*)* HTTP").PartialMatch(packet, &getUrl); cout << "GET " << getUrl << endl; And the text i want to match is something like: GET…
Gabriel Muñumel
  • 1,876
  • 6
  • 34
  • 57
0
votes
3 answers

Pattern for a specified character

I need to extract name from a big data pouch . $frame = '\"Amy Dardomba\":1,\"Kisb Muj Lorence\":1,\"Apkio Ronald\":1,.... there are more than 200-300 names which i have to put in array . i tried , …
0
votes
2 answers

Tokenising text using boost regex

I forget regular expressions faster then my mothers birthday. It is a major PITA. Anyhow I wanted a RE for parsing the HTTP response status line and have the sub-elements properly captured. I got this working : const boost::regex…
Hassan Syed
  • 20,075
  • 11
  • 87
  • 171
0
votes
2 answers

How do I use pcre_study with pcrecpp?

I'm using Google's C++ interface to PCRE to match a single regex multiple times (possibly thousands of times). From reading the PCRE manual, it seems like a good idea to let PCRE 'study' (spend time optimizing) the regex, however, I can't seem to…
Wander Nauta
  • 18,832
  • 1
  • 45
  • 62