summaryrefslogtreecommitdiffhomepage
path: root/pcre.html.markdown
diff options
context:
space:
mode:
authorDivay Prakash <divayprakash@users.noreply.github.com>2019-09-21 20:44:55 +0530
committerGitHub <noreply@github.com>2019-09-21 20:44:55 +0530
commitdb8c94cb2dce4bf548520ba211703f2aa3d0c7cd (patch)
tree4e0f52e1b8daf84574aee969fc292690358a417f /pcre.html.markdown
parent3a852a9a627c3bb627c840e040f739446f4abe4b (diff)
parentedcfd31759594ec55ccbedaae7a763fafbb17805 (diff)
Merge pull request #3625 from cdbax/fix-pcre-html-rendering
[pcre/en + it + zh-tw] Tweak markdown to properly render html
Diffstat (limited to 'pcre.html.markdown')
-rw-r--r--pcre.html.markdown25
1 files changed, 17 insertions, 8 deletions
diff --git a/pcre.html.markdown b/pcre.html.markdown
index 3e877a35..9e091721 100644
--- a/pcre.html.markdown
+++ b/pcre.html.markdown
@@ -3,16 +3,18 @@ language: PCRE
filename: pcre.txt
contributors:
- ["Sachin Divekar", "http://github.com/ssd532"]
-
+
---
-A regular expression (regex or regexp for short) is a special text string for describing a search pattern. e.g. to extract domain name from a string we can say `/^[a-z]+:/` and it will match `http:` from `http://github.com/`.
+A regular expression (regex or regexp for short) is a special text string for describing a search pattern. e.g. to extract domain name from a string we can say `/^[a-z]+:/` and it will match `http:` from `http://github.com/`.
PCRE (Perl Compatible Regular Expressions) is a C library implementing regex. It was written in 1997 when Perl was the de-facto choice for complex text processing tasks. The syntax for patterns used in PCRE closely resembles Perl. PCRE syntax is being used in many big projects including PHP, Apache, R to name a few.
There are two different sets of metacharacters:
+
* Those that are recognized anywhere in the pattern except within square brackets
+
```
\ general escape character with several uses
^ assert start of string (or line, in multiline mode)
@@ -32,18 +34,19 @@ There are two different sets of metacharacters:
```
* Those that are recognized within square brackets. Outside square brackets. They are also called as character classes.
-
+
```
-
+
\ general escape character
^ negate the class, but only if the first character
- indicates character range
[ POSIX character class (only if followed by POSIX syntax)
] terminates the character class
-
-```
-PCRE provides some generic character types, also called as character classes.
+```
+
+PCRE provides some generic character types, also called as character classes.
+
```
\d any decimal digit
\D any character that is not a decimal digit
@@ -59,7 +62,13 @@ PCRE provides some generic character types, also called as character classes.
## Examples
-We will test our examples on following string `66.249.64.13 - - [18/Sep/2004:11:07:48 +1000] "GET /robots.txt HTTP/1.0" 200 468 "-" "Googlebot/2.1"`. It is a standard Apache access log.
+We will test our examples on the following string:
+
+```
+66.249.64.13 - - [18/Sep/2004:11:07:48 +1000] "GET /robots.txt HTTP/1.0" 200 468 "-" "Googlebot/2.1"
+```
+
+ It is a standard Apache access log.
| Regex | Result | Comment |
| :---- | :-------------- | :------ |