Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - Search Help?!
Search Help?!
 
   NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
fargo
Agent


Joined: Aug 27, 2007
Posts: 16

PostPosted: Thu Mar 26, 2009 3:18 pm    Post subject: Search Help?!

Could you please help me to find every dot (.) in my document that is between two digits and replace it with a comma, e.g: 9.1 becomes 9,1

I have tried to search by format and regular expression but non worked for me.

Thank you in advance.
Back to top
Jim
Councilperson


Joined: Jun 21, 2003
Posts: 173
Location: Selmer, Tennessee

PostPosted: 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
Back to top
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Thu Mar 26, 2009 4:06 pm    Post subject:

Oops, Jim just beat me to it Wink

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
Back to top
Jim
Councilperson


Joined: Jun 21, 2003
Posts: 173
Location: Selmer, Tennessee

PostPosted: 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
Back to top
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Thu Mar 26, 2009 8:54 pm    Post subject:

Jim wrote:
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.

Now that you do have an account, I'll let you add this, too Wink

Smokey

_________________
"[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Back to top
fargo
Agent


Joined: Aug 27, 2007
Posts: 16

PostPosted: Fri Mar 27, 2009 5:44 am    Post subject:

Thank you Jim.

Unfortunately, it does not work for me Confused 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" !!
Back to top
Jim
Councilperson


Joined: Jun 21, 2003
Posts: 173
Location: Selmer, Tennessee

PostPosted: Fri Mar 27, 2009 6:40 am    Post subject:

fargo wrote:
Thank you Jim.

Unfortunately, it does not work for me Confused 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
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Page 1 of 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

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.