Bug 75806 - SearchWords in ReplaceDescriptor
Summary: SearchWords in ReplaceDescriptor
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-05 16:38 UTC by Goff
Modified: 2014-04-03 14:15 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Goff 2014-03-05 16:38:31 UTC
Let say, we have text and we need to replace all words "he" with "his". Also, we keep in mind that "he" may be beginning with capital - "He". 

Dim oDocument As Object
Dim oReplace As Object

oDocument = ThisComponent
	
oReplace = oDocument.createReplaceDescriptor
oReplace.searchAll=True

oReplace.SearchString = "(h)e"
oReplace.ReplaceString = "$1is"
oReplace.SearchRegularExpression = true
oReplace.SearchCaseSensitive = false
oReplace.SearchWords = true
oDocument.replaceAll(oReplace)

This macro replaces all "he/He" with "his/His", but all "she" will be replaced with "shis" as well.

"oReplace.SearchWords = true" does not work.

This bug is relevant to all versions of LibreOffice and OpenOffice.
Comment 1 Joel Madero 2014-03-07 03:23:28 UTC
Noel - thoughts on this one?
Comment 2 Goff 2014-03-11 19:47:23 UTC
Nobody is interesting?
Comment 3 Goff 2014-04-01 19:40:10 UTC
Looking for workaround for this bug, I found a next one.

Dim oDocument As Object
Dim oReplace As Object

oDocument = ThisComponent
	
oReplace = oDocument.createReplaceDescriptor
oReplace.searchAll=True

oReplace.SearchString = "\<(h)e\>"
oReplace.ReplaceString = "$1is"
oReplace.SearchRegularExpression = true
oReplace.SearchCaseSensitive = false
oDocument.replaceAll(oReplace)

Expected - he/He replaced with his/His and she will not be replaced

Current - all he/He replaced with $1is

Any ideas?
Comment 4 Joel Madero 2014-04-01 20:11:52 UTC
Please don't up the priority of your own bugs
Comment 5 Goff 2014-04-01 20:27:47 UTC
I will not.
Comment 6 Joel Madero 2014-04-01 21:30:59 UTC
Goff - are you trying to find someone to mentor you so you can make a patch or are you asking for workarounds?

If you're looking for a mentor I'll try to help - if you're asking for "user advice" on how to proceed given the problem - I suggest going to the ask.libreoffice.org site or the mailing list.
Comment 7 Goff 2014-04-03 14:15:29 UTC
Thank you Joel!

Unfortunately, I'm not able to patch this bug even supported by your help. And I've found a workaround, so it is not a bug that is crucial for me personally. I just want to tell - there are two bugs and this bugs exist since years, and LibreOffice will be better without this bugs because workaround looks not pretty. That is all.

Workaround (if someone has same problems):

Dim oDocument As Object
Dim oReplace As Object

oDocument = ThisComponent
	
oReplace = oDocument.createReplaceDescriptor
oReplace.searchAll=True

oReplace.SearchString = "([^A-Za-z]h|^h)e\>"
oReplace.ReplaceString = "$1is"
oReplace.SearchRegularExpression = true
oReplace.SearchCaseSensitive = false
oDocument.replaceAll(oReplace)

Thank you for your offer))


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.