• Home
  • Blog
  • Projects
    • QWcrm
    • Joomla
      • mod_helloworld
      • plg_helloworld
      • QWRealURL
  • KB
    • Articles
    • Links
  • Forum
  • Stuff
    • Links
  • Search
  • Docker Target
  • Login
QuantumWarp QuantumWarp QuantumWarp
  • Home
  • Blog
  • Projects
    • QWcrm
    • Joomla
      • mod_helloworld
      • plg_helloworld
      • QWRealURL
  • KB
    • Articles
    • Links
  • Forum
  • Stuff
    • Links
  • Search
  • Docker Target
  • Home >
  • KB >
  • Links >
  • Programming >
  • RegEx >
  • Articles >
  • regex - PHP: String to array, check spelling, back to string (preserving special characters) - Stack Overflow

regex - PHP: String to array, check spelling, back to string (preserving special characters) - Stack Overflow

I'm working on a custom spell checker (and learning as I go) that needs to do the following upon form submission:

  1. Convert the string submitted from textarea into an array of words.
  2. Search for each word in the array in the mysql english table.
  3. If the word does not exist, mark it as misspelled by wrapping it in an HTML tag.
  4. Convert the array back to a string including original punctuation, line breaks and the newly-tagged words.

I've searched many a post as well as php.net and I've come up with the following code that does everything except #4 and I've been stuck there for a couple days (I assume I need to add something in or before #1 for the preservation part but I can't seem to wrap my head around it):

This is a stackoverflow thread on this topic.

Listing Details

{stwpreview url="http://stackoverflow.com/questions/14177170/php-string-to-array-check-spelling-back-to-string-preserving-special-charact" link="no" divwrap="no"}
Website
stackoverflow.com/questions/14177170/php-string-to-array-che...
Visited
130

Legal

  • Attribution
  • DMCA
  • Privacy & Cookies
  • Terms & Conditions

Resources

  • Feedback
  • Downloads
  • Typography

QuantumWarp

  • About
  • Contact

Follow Us

  • GitHub