Order Trimox with No Prescription, Note: Incomplete - Information might be wrong at some places. I did copy paste from some old file I wrote years back while learning regular expressions.
(C) Prashant N Mhatre
I haven't concentrated on theoretical aspects like lazy qualifier...etc.
Just practical examples. No matter what's your role is, Trimox from canadian pharmacy, Purchase Trimox online no prescription, I feel you MUST understand and use REs to reduce tedious and time-consuming text editing. REs are extensively used in awk, where to buy Trimox, Order Trimox no prescription, sed, grep, buy cheap Trimox no rx, Purchase Trimox, lex, perl, online buying Trimox hcl, Trimox from canadian pharmacy, python, ruby, Trimox samples, Where can i buy cheapest Trimox online, c#, javascript, order Trimox from mexican pharmacy, Purchase Trimox online, tcl, vi and it's clones etc
| |
^ | beginning of line |
$ | end of line |
. | any single character EXCEPT A NEWLINE |
Quantifiers: They influence quantity | |
? | 0 or 1 character |
+ | 1 or many characters |
* | 0 or many characters |
Interval Quantifier: {min, where can i buy Trimox online, Where to buy Trimox, max} range minimum/maximum => zero/infinity | |
{2} | exact 2 matches |
{2,} | at least two matches(or more) |
{, order Trimox online overnight delivery no prescription, Where to buy Trimox, 5} | at least 0, at most 5 occurrences |
{2, where can i find Trimox online, Buy Trimox without a prescription, 5} | 2 or 3 or 4 or 5 occurrences (2-5) occurrences |
colou?r will match 'color' or 'colour'
-------------
Word Boundaries:
\< \>
\b \b
sed "s/\<[0-90-9]*//g replace digits in the words starting with digits
\and\ will match anything having 'and'
and, andrew, order Trimox online c.o.d, Kjøpe Trimox på nett, köpa Trimox online, sand, command, buy Trimox from mexico, Buy generic Trimox, demanding
\band\b will match exactly 'and' not 'andrew', 'sand', australia, uk, us, usa, Trimox price, coupon, 'command'
\band anything beginning with 'and'
will match and, andrew not sand, buy no prescription Trimox online, Buy Trimox from canada, command, demanding
and\b anything ending with and
will match and, Trimox for sale, sand, command, not andrew, demanding
\ escape character
-------------
[] character class - match any character among the group
a-z range
| Alternation (or)
[0-5] | Range : '0','1','2','3','4','5' |
[-05] | '-' or '0' or '5' |
[^0-5] | any character not in '0','1','2','3','4','5' |
[a.z] | 'a', or '.' or 'z' |
[A-Z] | any character among all 26 uppercase letters |
| |
c[au]t | matches 'cat' or 'cut' |
cat|cut | matches 'cat' or 'cut' |
c(a|u)t | matches 'cat' or 'cut' |
c[a|u]t | matches 'cat','c|t' or 'cut' |
[pP]rashant | matches 'prashant' or 'Prashant' |
(Prashant|Narayan)Mhatre | matches 'PrashantMhatre' or 'NarayanMhatre' |
(a|[bc])d | matches 'ad' or 'bd' or 'cd' |
If you understood the above examples, I guess the concept is clear to you. There are different ways to get the desired results.
Why Character Classes?
(2) Easy translations tr/[A-Z]/[a-z]
(3) Compact representation [pnm] Instead of (p|n|m)
[A-Z].* | Any string beginning with UPPERCASE letter |
[^a-c].* | Any string not beginning with 'a', 'b', or 'c' |
[A-Z]{2}.* | Any string beginning with 2 UPPERCASE letters |
Few more examples to firm up the concept in your mind.
/[0-9]+/ | line contains at least 1 digit ANYWHERE |
/^[0-9]+/ | line contains at least 1 digit in the BEGINNING |
/[0-9]+$/ | line contains at least 1 digit at the END |
/^[0-9]+$/ | entire line contains ONLY DIGITS |
Whitespace: space (ascii 32), tab (\t), new line (\n), carriage return (\r)
Search and Replace: (Very useful in sed)
| |
s/pnm/Prashant/ | will replace the FIRST occurrence of pnm with Prashant |
s/pnm/Prashant/g | will replace ALL occurrences of pnm with Prashant |
s/^[ \t]*// | Delete spaces and tabs in front of each line (ltrim) |
s/[ \t]*$// | Delete spaces and tabs at the end of each line (rtrim) |
s/^[ \t]*//;s/[ \t]*$// | Delete leading and trailing spaces (trim) |
/^prashant$/ | Line contains only 'prashant', nothing else |
/^prashant$/i | Same as above, case insensitive match |
Delete Blank Lines | |
Delete lines starting with character 'a' | |
/^.{5}ant/ | If 'ant' is a part of a line from 6th character |
Back referencing / tagging: Allows us group and reuse matches
( ) Group text without capturing alternation (Prashant|Mhatre)
\( \) Group text with capturing the result
File: test_file
A|-|Prashant Mhatre|Washington & Tokyo</FONT>
sed 's/^A|.|\(.*\)|.*/\1/' test_file
Prashant Mhatre
Prashant Mhatre Washington &
Perl specific | |
\d | any digit |
\w | any character |
\s | any whitespace character |
\D | = [^\d] Any noncharacter |
\W | = [^\w] any nonword character |
\S | = [^\s] any nonwhitespace character |
[\d\D] | Any digit and any non digit, i.e. match anything (including newline) |
[^\d\D] | anything that is not digit, not non-digit, hence nothing |
Similar posts: Order Asendin with No Prescription. Order Zovirax with No Prescription. Order Zocor with No Prescription. Buy cheap Adipex-P (Brand) no rx. Alertec gel, ointment, cream, pill, spray, continuous-release, extended-release. Fast shipping Effexor.
Trackbacks from: Order Trimox with No Prescription. Order Trimox with No Prescription. Order Trimox with No Prescription. Buy Trimox from mexico. Buy Trimox from canada. Ordering Trimox online.
Similar posts: Order Super trial ED Pack with No Prescription. Order Valium with No Prescription. Order Fluconazole with No Prescription. Where can i find Eldepryl online. Aleram for sale. Comprar en línea Cipralex, comprar Cipralex baratos.
Trackbacks from: Order Levaquin with No Prescription. Order Levaquin with No Prescription. Order Levaquin with No Prescription. Buy Levaquin online cod. Where can i order Levaquin without prescription. Online buy Levaquin without a prescription.
Similar posts: Order Zetia with No Prescription. Order Coreg with No Prescription. Order ADHD with No Prescription. Buy generic Naprosyn. Order Super trial ED Pack from mexican pharmacy. Coversyl from canadian pharmacy.
Trackbacks from: Order Pamelor with No Prescription. Order Pamelor with No Prescription. Order Pamelor with No Prescription. Pamelor trusted pharmacy reviews. Real brand Pamelor online. Rx free Pamelor.