How do I create a regular expression to match a word misspelling the original case sensitivity?

Posted by Patrick Allaert on Stack Overflow See other posts from Stack Overflow or by Patrick Allaert
Published on 2010-05-06T08:30:03Z Indexed on 2010/05/06 8:38 UTC
Read the original article Hit count: 270

Filed under:

I want to discover wrong spelling of "FooBar" in sentence:

"This is a 'FooBar' example where I should match different spelling of fooBar such as: foobar, FOOBAR or even fOoBaR but not foobarS!"

In this sentence, I would like to match words (in order): fooBar, foobar, FOOBAR, fOoBaR and not: FooBar (correct spelling), foobarS (not the same word)

Is there an existing solution using Perl Regular Expression? This is intended to be used with grep -P

Thanks

© Stack Overflow or respective owner

Related posts about regex