Hello,

it seems like wordfilter is not case-sensitive. Since I use Word filter as a way to correct exotic character in my language (æ/Æ and œ/Œ), I need case-sensitiveness. I have already one example where the text is broken because of this, with an uppercase in the middle of a word (europÆa).

Any plan to add case-sensitiveness anytime soon?

Thank you

CommentFileSizeAuthor
#13 781560-case-sensitive.patch2.37 KBjaydub

Comments

jaydub’s picture

I don't have time to work on this myself at this time. Depending on whether you feel comfortable patching your local version of the module you could likely get what you want by passing a parameter to the preg_replace() PHP function call that will enable case sensitivity. If you are comfortable editing your module source let me know and I'll describe what -should- in theory allow case sensitivity to work.

jaydub’s picture

Status: Active » Postponed

I'll look at adding this as a new feature for the D7 version of the module and down the line if it's possible to backport the changes to d6.

jaydub’s picture

Issue tags: +Drupal 7.x
jaydub’s picture

Issue tags: +Case Sensitivity
David Latapie’s picture

Thanks jaydub. I won't feel comfortable patching anything, since I neither nor want to learn how to write PHP. I hope someone else will!

Michsk’s picture

jaydub, i do feel comfortable. Could you describe it a bit more.

jaydub’s picture

by default the case insensitive flag is sent to the PHP regular expression function used in wordfilter. If you have any familiarity with regular expressions, the flag used is 'i'. You might see a typical regex like this:

$replacement = preg_replace('/foo/bar/i', $original);

With the 'i' at the end of the expression '/foo/bar/i' then any of these strings would be replaced:

FOO -> bar
Foo -> bar
fOO -> bar

and so on.

If you want to patch the module yourself to remove case sensitvity, look for the functions preg_quote() and preg_split() and where you see 'i' as in '/i' you can just remove the 'i'.

anonymous07’s picture

Subscribe

Michsk’s picture

i am extremley bussy finishing up a project, so i wont have time atm to try this.

hedac’s picture

thank you. removing the i in preg_quote and preg_split functions works perfectly.

David_Rothstein’s picture

Hm, this issue was postponed (so I didn't see it) but I just posted a D7 patch for this at #2045243: Allow word filtering to be case-sensitive. We could merge the two issues...

jaydub’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Assigned: Unassigned » jaydub
Issue summary: View changes
Status: Postponed » Needs review
jaydub’s picture

StatusFileSize
new2.37 KB

For now I've done a simple implementation that sets a global for case sensitiveness in the admin settings. A later update can include the option of setting case sensitive per configured search word/replacement word as can be done with the standalone setting. But that will require DB schema changes so for now, offering this up as a solution for those that can use it as a global.

  • Commit 6fd61a3 on 7.x-1.x by jaydub:
    Issue #781560 by jaydub, David_Rothstein: Allow case sensitive word...
jaydub’s picture

Status: Needs review » Fixed

Marking this as fixed, will open a new ticket later if time permits to make case sensitiveness a per search word/replacement word option.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.