$re = '/([a-z]+(?:\'[a-z]+|(?:\-[a-z]+)+)?)/i';
$str = 'I\'m working on a small program to perform various tasks on text content, primarily at the word level. I wrote these methods as ways to help prepare the raw text file into something more malleable, like a List<String>, where at a later point I can perform various routines such as counting and sorting words, and so on.
Concerns:
In splitTextStringIntoWordList I found myself having to split textString param into String[] array, and immediately afterwards adding the elements from the array one at a time, parsing with regex, into a List<String>. Is there a better way to do this that might not need as much manipulation?
Are some of my methods just doing too many things between parameters and return?
Is the JavaDoc clear, concise and descriptive?
What are some beginner mistakes I might be making?
break-a-leg';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php