View Single Post
Old 08-30-2005, 06:25 AM   #10 (permalink)
DCoder
Senior Member
 
Join Date: Jul 2003
Location: Lithuania, Central Europe
Posts: 1,056
Send a message via MSN to DCoder
Default

OK, let's take a simple example:
How many searches will it take you to find things that cost from 500 to 999 credits?
Either you just search for "Cost=" and look at ~300 entries with 2/3rds of them irrelevant, or search for "Cost=5", "Cost=6", ... "Cost=9" and take five searches, as well as catching Cost=5000 things.
I, on the other hand, will just search for "Cost=[5-9]\d\d\b" , and voila: I will find all objects that have a Cost= set to a "three-digit number starting with 5, 6, 7, 8 or 9, that is followed by any non-numeric character (including endline)".

RegExps are fantastically powerful and helpful, not only in ini coding, but also in any other text editing related work. Automatic e-mail validation, fixing duplicated words ("this this" => "this"), BBCode <> HTML, you name it, regexp can do it.
DCoder is offline   Reply With Quote