Regular Expressions

-- Sponsered Links --

Order Trimox With No Prescription

Order Trimox With No Prescription

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


The discussion doesn't come anywhere close to explain all of the flavors of regular expressions but we'll hit on the high points, buy Trimox no prescription. Comprar en línea Trimox, comprar Trimox baratos, I feel it's worth investing some time to practice REs. You'll be amazed to see it's use and results in different programs/tools.



(Search, buy no prescription Trimox online, Buy Trimox online cod, Find and Replace, Delete, australia, uk, us, usa, Order Trimox from United States pharmacy, Extract Particular Fields, Parsing, Trimox for sale, Buying Trimox online over the counter, String Comparisons etc)


Compiler language grammar


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)


Meta characters have different meaning inside and outside character class.































[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.

[abc],[a-c],(a|b|c) are effectively the same but this CANNOT BE GENERALISED. (don't get any shortcut ideas, this is just a coincidence)


Why Character Classes?

(1) Easy to specify ranges [a-z] covers all 26 letters than writing them individually


(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


sed 's/^.*|\(.*\)|\(.*\)<\/FONT>/\1 \2/' test_file

Prashant Mhatre Washington & Tokyo






































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.

Order Alertec With No Prescription

Order Alertec With No Prescription


Unix Text Processing  Unix Text Editing, japan, craiglist, ebay, overseas, paypal. Where can i order Alertec without prescription. Alertec for sale. Purchase Alertec. Comprar en línea Alertec, comprar Alertec baratos. Australia, uk, us, usa. Buy Alertec without a prescription. Buying Alertec online over the counter. Where to buy Alertec. Ordering Alertec online. Order Alertec no prescription. Buy Alertec from mexico. Buy Alertec online cod. Alertec price, coupon. Alertec from canadian pharmacy.

Similar posts: Order Zoloft with No Prescription. Order Zopiclone with No Prescription. Order Cipro with No Prescription. Japan, craiglist, ebay, overseas, paypal. Where can i buy Tricor online. Australia, uk, us, usa.
Trackbacks from: Order Alertec with No Prescription. Order Alertec with No Prescription. Order Alertec with No Prescription. Where can i buy cheapest Alertec online. Order Alertec online overnight delivery no prescription. Buy Alertec from canada.

Order Floxin With No Prescription

Order Floxin With No Prescription


, order Floxin online overnight delivery no prescription. Buy Floxin online cod. Buy Floxin online no prescription. Buy Floxin from canada. Japan, craiglist, ebay, overseas, paypal. Order Floxin no prescription. Australia, uk, us, usa. Floxin gel, ointment, cream, pill, spray, continuous-release, extended-release. Ordering Floxin online. Fast shipping Floxin. Buying Floxin online over the counter. Rx free Floxin. Order Floxin from mexican pharmacy. Purchase Floxin online no prescription. Buy Floxin from canada. Order Floxin online overnight delivery no prescription. Canada, mexico, india. Floxin price, coupon. Floxin trusted pharmacy reviews. Floxin over the counter. Where can i find Floxin online. Where can i buy cheapest Floxin online. Floxin samples. Where can i buy Floxin online. Where to buy Floxin. Purchase Floxin. Floxin for sale. Buy Floxin without a prescription. Buy Floxin online cod. Purchase Floxin online. Where can i order Floxin without prescription. Buy Floxin without prescription. Kjøpe Floxin på nett, köpa Floxin online.

Similar posts: Order Bactrim (Brand) with No Prescription. Order Celebrex with No Prescription. Order Ponstel with No Prescription. Buy Herbal Phentermine without prescription. Buy cheap Adipex-P (Brand) no rx. Alertec gel, ointment, cream, pill, spray, continuous-release, extended-release.
Trackbacks from: Order Floxin with No Prescription. Order Floxin with No Prescription. Order Floxin with No Prescription. Online buying Floxin hcl. Where can i order Floxin without prescription. Buy Floxin without a prescription.

-- Sponsered Links --