[clug] Circumflex

Bryan Kilgallin (iiNet) kilgallin at iinet.net.au
Sun Aug 20 09:26:10 UTC 2017

Thanks, Scott:

> Match on start of line followed by any digit
> grep -P '^\d'
> or
> grep -P "^\d"
> (I suspect the "" is incorrect, though it works).

{Sometimes features such as parameter expansion and character escapes 
get in the way. When that happens, the user can write a parameter within 
quotes, either ' (single quote) or " (double quote). There is one 
important difference between single quoted and double quoted strings: 
When using double quoted string, variable expansion still takes place. 
Other than that, no other kind of expansion (including brace expansion 
and parameter expansion) will take place, the parameter may contain 
spaces, and escape sequences are ignored. The only backslash escape 
accepted within single quotes is \', which escapes a single quote and 
\\, which escapes the backslash symbol. The only backslash escapes 
accepted within double quotes are \", which escapes a double quote, \$, 
which escapes a dollar character, \ followed by a newline, which deletes 
the backslash and the newline, and lastly \\, which escapes the 
backslash symbol. Single quotes have no special meaning within double 
quotes and vice versa.}


>> What Web resource explains standard, extended, and Perl variants?
> https://en.wikipedia.org/wiki/Regular_expression

I have bookmarked that page.

> or, look at the book I sent you

I am on page twenty five of it.


More information about the linux mailing list