Latest News

Linux Regular Expressions Most Simplified




Regular Expressions 

.
Any single character


*
0 or more of the preceding character

+          \+
One or more of the preceding character
?          \?
0 or 1 of the preceding character
{ }         \{ \}
Match exactly num of the preceding character:
{x}-          match x repetitions
{x,}          match x or more
{,x}          match 0 – x repetitions
{x,y}        match x to y repetions


^
Match Beginning of line
$
Match End of line
<          \<
Match Beginning of word
>          \>
Match End of word


[ ]
Range – match any character within the range
[^ ]
Negation – match any character NOT within the range


( )         \( \)
Group a pattern as a single entity 
\1 ... \9
Match group \#


|           \|
Separate choices to match (| is the c-language token for logical OR)


The following have special meaning only in replacement patterns
&
Reuse the search pattern as the current replacement pattern
\u
Convert first character of replacement pattern to uppercase
\U
Convert entire replacement pattern to uppercase
\l
Convert first character of replacement patter to lowercase
\L
Convert entire replacement pattern to lowercase















No comments:

Post a Comment

Dear visitor, we appreciate your effort to comment and encourage us. Please do not post spam. All comments will be moderated before approval.

Techeia.com Designed by Templateism.com Copyright © 2014

Free Blogger Themes

Designed by Techeia.com Copyright © 2016

Powered by Blogger.