Perl Quick Reference Card Operator Precedence (continued) 87 tr/// Modifiers 156 Associativiy Arity Precedence Class /c Complement SEARCHLIST. version 0.01 – editor: John Bokma – freelance programmer Right 3 ?: /d Delete found but unreplaced characters. DRAFT VERSION, check: http://johnbokma.com/perl/ Right 2 and so on /s Squash duplicate replaced characters. Backslashed Character Escapes 61 = += -= *= Left 2 , => Newline (usually LF) ESC character General Regex Metacharacters 159 \n \e Right 0+ List operators (rightward) \r Carriage return (usually CR) \033 ESC in octal Symbol Atomic Meaning Right 1 not \t Horizontal tab \x7f DEL in hexadecimal … Varies De-meta next nonalphanumeric character, meta Left 2 and \ \f Form feed \cC Control-C next alphanumeric character (maybe). Left 2 or xor \b Backspace \x{263a} Unicode (smiley) …|… No Alternation (match one or the other). \a Alert (bell) \N{NAME} Named character File Test Operators 98 (…) Yes Grouping (treat as a unit). File is readable by effective UID/GID. […] Yes Character class (match one character from a set). Translation Escapes 61 -r -w File is writable by effective UID/GID. \u Force next character to uppercase (“titlecase” in Unicode). -x File is executable by effective UID/GID. \l Force next character to lowercase. ^ No True at beginning of string (or after a newline, -o File is owned by effective UID/GID. \U Force all following characters to uppercase maybe). -R File is readable by real UID/GID. \L Force all following characters to lowercase . Yes Match one character (except newline, normally). -W File is writable by real UID/GID. \Q Backslash all following nonalphanumeric characters. $ No True at end of string (or before any newline, -X File is executable by real UID/GID. \E End \U, \L, or \Q. maybe). -O File is owned by real UID/GID. Quote Constructs 63 -e File exists. Regex Quantifiers 159-160 File has zero size Quantifier Atomic Meaning Customary Generic Meaning Interpolates -z -s File has nonzero size (returns size). * No Match 0 or more times (maximal). -f File is a plain file. + No Match 1 or more times (maximal). '' q// Literal string No -d File is a directory. ? No Match 0 or 1 time (maximal). "" qq// Literal string Yes -l File is a symbolic link. {COUNT} No Match exactly COUNT times. `` qx// Command execution Yes -p File is a named pipe (FIFO). {MIN,} No Match at least MIN times (maximal). () qw// Word list No -S File is a socket. {MIN,MAX} No Match at least MIN but not more than MAX // m// Pattern match Yes -b File is a block special file. times (maximal). s/// s/// Pattern substitution Yes -c File is a character special file. y/// tr/// Character translation No -t Filehandle is open to a tty. *? No Match 0 or more times (minimal). "" qr// Regular expression Yes -u File has setuid bit set. +? No Match 1 or more times (minimal). Note: no interpolation is done if you use single quotes for delimiters. -g File has setgid bit set. ?? No Match 0 or 1 time (minimal). -k File has sticky bit set. {MIN,}? No Match at least MIN times (minimal). Operator Precedence 87 -T File is a text file. {MIN,MAX}? No Match at least MIN but not more than MAX Associativiy Arity Precedence Class -B File is a binary file (opposite of -T). times (minimal). None 0 Terms, and list operators (leftward) -M Age of file (at startup) in (fractional) days since modification. Extended Regex Sequences 160 Left 2 -> -A Age of file (at startup) in (fractional) days since last access. Extension Atomic Meaning None 1 ++ -- -C Age of file (at startup) in (fractional) days since inode change. (?#… Right 2 ** ) No Comment, discard. Pattern Modifiers 147 …) Right 1 ! ~ > and unary + and unary - (?: Yes Cluster-only parentheses, no capturing. Left 2 =~ !~ /i Ignore alphabetic case distinctions (case insensitive). (?imsx-imsx) No Enable/disable pattern modifiers. …) Left 2 * / % x /s Let . match newline and ignore deprecated $* variable. (?imsx-imsx: Yes Cluster-only parentheses plus modifiers. …) Left 2 + - . /m Let ^ and $ match next embedded \n. (?= No True if lookahead assertion succeeds. …) Left 2 << >> /x Ignore (most) whitespace and permit comments in pattern. (?! No True if lookahead assertion fails. Right 0,1 Named unary operators /o Compile pattern only once. (?<=…) No True if lookbehind assertion succeeds. None 2 (?<!…) No True if lookbehind assertion fails. < > <= >= lt gt le ge Additional m// Modifiers 150 None 2 == != <=> eq ne cmp (?>…) Yes Match nonbacktracking subpattern. /g Globally find all matches. Left 2 & (?{…}) No Execute embedded Perl code. /cg Allow continued search after failed /g match. Left 2 | ^ (??{…}) Yes Match regex from embedded Perl code. … … … Yes Match with if-then-else pattern. Left 2 && Additional s/// Modifiers 153 (?( ) | ) (?(…)…) Yes Match with if-then pattern. Left 2 || /g Replace globally, that is, all occurences. None 2 .. ... /e Evaluate the right side as an expression..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages1 Page
-
File Size-