View Single Post
Old 06-22-2010, 09:29 PM   #10
capidamonte
Not who you think I am...
capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.capidamonte can even cheer up an android equipped with a defective Genuine Personality Prototype.
 
capidamonte's Avatar
 
Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
Quote:
OK, now the fun part. the "Replace With:" string looks like this:

<h1>\1</h1>

which means that the <p class="h1"> gets replaced by <h1>, the </p> gets replaced with </h1>, and the contents of variable \1 (i.e. the actual text of the header) gets put in between.
Minor niggle:

Your explanation implies that because your search has three parts and your replacement has three parts, each part is being individually replaced.

It's one blob being replaced by another blob that has a sub-blob being remembered from the first blob and inserted somewhere. Does that make sense?

As a way of exampling, using your search example above, you could replace with \1 or MAD-SEARCHEZ!!1 or <h1></h1>\1 -- it's all one blob, replacing the blob that matched the search blob.

The reason I stress this, it's really useful to change the order of things using multiple sub-matches, but you must be clear that the pattern is not implicit, it's an overt expression.

June 14th, 2010, say, can become 14-June-2010 or 2010-June-14 or anything else pretty easily. e.g.

Code:
Search: (.+) (\d\d)th (\d\d\d\d)
Replace: \2-\1-\3
  or
Replace: \3-\1-\2
  or
Replace: Today is the \2th day of the month of \1 in the year \3.
Hope that wasn't too much,

cap
capidamonte is offline   Reply With Quote