Hi all. I'm having a really hard time trying to figure out how to perform a particular function. I'm not very good with regular expressions, and just can't seem to work out what I'm going for.
Basically, we receive support emails, and have an automated function to stuff the body of the email into a database. I'm writing an interface to the database and need to display the results returned from the db to a webpage. However, we generally have several spams full of HTML code that gets crammed into the db. Things work fine until I get some spam message that has <HTML><CODE><WITHOUT><ANY><SPACES> in it. This throws the tables and entire page out of whack.
Since the body of the email is all in one variable, I need to go through a single variable and search for a string of X amount of characters without a space between them.
Examples: I want to split a string that has 5 characters without spaces. I don't want to reformat anything other than exact matches.
$variable1 = "1234567890"
$fixed_variable1 = "12345 67890"
$variable2 = "123 456 7890"
$fixed_variable2 = "123 456 7890"
$variable3 = "123456 7890"
$fixed_variable3 = "12345 6 7890"
Any thoughts on how to do this?