Joined: Jun 21, 2003 Posts: 173 Location: Selmer, Tennessee
Posted: Thu Mar 26, 2009 3:45 pm Post subject:
Search for: ([0-9])\.([0-9])
Replace: $1,$2
Explanation:
Searching for [0-9] finds any digit. You have to escape the dot, because otherwise it directs the finding of *any* character--so you want to find the literal dot.
The parentheses are cool. Enclosing a search term in them "brands" whatever's found in that place like AWK or PERL's terms. So we enclose the set of digits in parens, separate with the escaped dot, and repeat the paren-enclosed search for a number.
In the "Replace" box, the $ represents what was found by the parenthesized expressions. The $1 represents the first set, and of course the $2 represents whatever was found by the second set. So we're replacing the first found number with itself, adding the comma, and replacing the second parenthesized find with itself.
Oh, and don't forget to check the "Regular Expressions" box under the "more options" button in the Find & Replace dialog. _________________ Jim Plante
MacOS X 10.6.34, MacBook 2GHz C2Duo, 2gb, Neo 3.1.1 p 1
Last edited by Jim on Thu Mar 26, 2009 4:23 pm; edited 1 time in total
Jim, do you have a wiki account? I think this is probably a good example to add to the examples section of Using Find and Replace. If you don't have one, I (or another wiki-elf) can add it.
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Joined: Jun 21, 2003 Posts: 173 Location: Selmer, Tennessee
Posted: Thu Mar 26, 2009 4:17 pm Post subject:
Smokey, go ahead and add it. I don't have a wiki account (at least, not that I know of.) Not sure how to work that thing anyway. _________________ Jim Plante
MacOS X 10.6.34, MacBook 2GHz C2Duo, 2gb, Neo 3.1.1 p 1
Unfortunately, it does not work for me The string found is literally replaced with $1,$2. I mean, the dots are not replaced with commas, but the whole thing is replaced by text "$1,$2" !!
Joined: Jun 21, 2003 Posts: 173 Location: Selmer, Tennessee
Posted: Fri Mar 27, 2009 6:40 am Post subject:
fargo wrote:
Thank you Jim.
Unfortunately, it does not work for me The string found is literally replaced with $1,$2. I mean, the dots are not replaced with commas, but the whole thing is replaced by text "$1,$2" !!
Fargo,
I just did a check with Neo v. 2.5 p 7 on a PPC. I'm sorry to say that the method I described won't work in that version. Neither does the escaped version, \1 and \2.
Since I don't have your data to work with, I can tentatively suggest that you try [0-9]\. as s search string, and replace with &, (ampersand comma). But that will likely cause problems with sentences that end in numbers. You'd have to manually clean such instances. (I.e., search for occurrences of "[0-9], " (digit comma space) and manually do the replacement of the comma with a period.)
However, the method I first described works just fine in NeoOffice v. 3, which will be available on March 31 as a free download. (Or you can donate and download it now.) _________________ Jim Plante
MacOS X 10.6.34, MacBook 2GHz C2Duo, 2gb, Neo 3.1.1 p 1
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum