A Flexible PHP Text Parser Without Regular Expressions

Regular expressions are great but sometimes you want to do it faster (meaning easier), depending on what you’re trying to do. ¬†When you quickly want to parse repetitive text and return an array this function can come in handy.

Example 1) Grab text from html table into an array

output:

Array
(
	[0] => 1 b
	[1] => 2 b
	[2] => 3 b
)

Example 2) Parse subject from email headers

In this example were not expecting or even wanting an array, just the 1st result match.

output:

Welcome to the Online Congress Community.

Parse Function