- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Regular Expression Special Variables in Perl
There are various Regular Expression Special Variables in Perl. We have listed them in different below in tabular form −
$digit | Contains the text matched by the corresponding set of parentheses in the last pattern matched. For example, $1 matches whatever was contained in the first set of parentheses in the previous regular expression. |
$& | The string matched by the last successful pattern match. |
$MATCH | |
$` | The string preceding whatever was matched by the last successful pattern match. |
$PREMATCH | |
$' | The string following whatever was matched by the last successful pattern match. |
$POSTMATCH | |
$+ | The last bracket matched by the last search pattern. This is useful if you don't know which of a set of alternative patterns was matched. For example : /Version: (.*)|Revision: (.*)/ && ($rev = $+); |
- Related Articles
- Filehandle Special Variables in Perl
- How to use special characters in Python Regular Expression?
- How to use variables in Python regular expression?
- How to create regular expression only accept special formula?
- Perl Special Literals
- The $[ Special Variable in Perl
- Creating Variables in Perl
- Global Special Variable Types in Perl
- Perl Scalar Variables
- Perl Array Variables
- Perl Hash Variables
- Write a Regular Expression to remove all special characters from a JavaScript String?
- Perl CGI Environment Variables
- State Variables via state() in Perl
- Moving all special char to the end of the String using Java Regular Expression RegEx)

Advertisements