Unix and Linux Discussions Tagged with delimiter |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
5 |
11,163 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
18,490 |
Shell Programming and Scripting |
|
|
|
6 |
16,544 |
UNIX for Advanced & Expert Users |
|
|
|
2 |
10,224 |
Shell Programming and Scripting |
|
|
|
7 |
9,120 |
Shell Programming and Scripting |
|
|
|
5 |
3,991 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
1,417 |
Shell Programming and Scripting |
|
|
|
5 |
2,624 |
Programming |
|
|
|
3 |
8,964 |
UNIX for Beginners Questions & Answers |
|
|
|
6 |
4,599 |
Programming |
|
|
|
2 |
2,414 |
Shell Programming and Scripting |
|
|
|
4 |
2,468 |
UNIX for Dummies Questions & Answers |
|
|
|
7 |
6,691 |
Shell Programming and Scripting |
|
|
|
7 |
4,819 |
Shell Programming and Scripting |
|
|
|
13 |
52,595 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
2,790 |
Shell Programming and Scripting |
|
|
|
5 |
106,060 |
Shell Programming and Scripting |
|
|
|
4 |
4,774 |
Shell Programming and Scripting |
|
|
|
11 |
5,655 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
39,521 |
Shell Programming and Scripting |
|
|
|
7 |
15,258 |
Shell Programming and Scripting |
|
|
|
3 |
3,009 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
10,724 |
Shell Programming and Scripting |
|
|
|
1 |
2,860 |
Shell Programming and Scripting |
|
|
|
4 |
4,285 |
Shell Programming and Scripting |
|
|
|
4 |
3,009 |
Shell Programming and Scripting |
|
|
|
3 |
10,231 |
Shell Programming and Scripting |
|
|
|
5 |
4,085 |
Shell Programming and Scripting |
|
|
|
7 |
21,161 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
3,039 |
Shell Programming and Scripting |
|
|
|
11 |
3,952 |
Shell Programming and Scripting |
|
|
|
4 |
4,853 |
Shell Programming and Scripting |
|
|
|
0 |
3,143 |
Shell Programming and Scripting |
|
|
|
9 |
4,807 |
Shell Programming and Scripting |
|
|
|
1 |
6,962 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
1,917 |
Shell Programming and Scripting |
|
|
|
4 |
14,555 |
Shell Programming and Scripting |
|
|
|
6 |
6,503 |
Shell Programming and Scripting |
|
|
|
5 |
7,362 |
Shell Programming and Scripting |
|
|
|
4 |
8,505 |
Shell Programming and Scripting |
PREG_QUOTE(3) 1 PREG_QUOTE(3)
preg_quote - Quote regular expression characters
SYNOPSIS
string preg_quote NULL (string $str, [string $delimiter])
DESCRIPTION
preg_quote(3) takes $str and puts a backslash in front of every character that is part of the regular expression syntax. This is useful if
you have a run-time string that you need to match in some text and the string may contain special regex characters.
The special regular expression characters are: . + * ? [ ^ ] $ ( ) { } = ! < > | : -
PARAMETERS
o $str
- The input string.
o $delimiter
- If the optional $delimiter is specified, it will also be escaped. This is useful for escaping the delimiter that is required by
the PCRE functions. The / is the most commonly used delimiter.
RETURN VALUES
Returns the quoted (escaped) string.
CHANGELOG
+--------+--------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+--------------------------------+
| 5.3.0 | |
| | |
| | The - character is now quoted |
| | |
+--------+--------------------------------+
EXAMPLES
Example #1
preg_quote(3) example
<?php
$keywords = '$40 for a g3/400';
$keywords = preg_quote($keywords, '/');
echo $keywords; // returns $40 for a g3/400
?>
Example #2
Italicizing a word within some text
<?php
// In this example, preg_quote($word) is used to keep the
// asterisks from having special meaning to the regular
// expression.
$textbody = "This book is *very* difficult to find.";
$word = "*very*";
$textbody = preg_replace ("/" . preg_quote($word, '/') . "/",
"<i>" . $word . "</i>",
$textbody);
?>
NOTES
Note
This function is binary-safe.
SEE ALSO
PCRE Patterns, escapeshellcmd(3).
PHP Documentation Group PREG_QUOTE(3)