As managing editor of BadCyberPoetry.net you find to your dismay that you must follow through on your threat to replace your "Editor of Conventionally Structured Poetry" with a very small shell script (or something to that effect).
The first part of this project is to build a method that returns the last cyberword of a cyberline of cybertext, in a form that is convenient for rhyme testing. Since this is bad cyber poetry, words may contain symbols other than letters.
A "cyberword" may contain letters, numbers, the hyphen (minus) character '-' and the '@' character (quotes for clarity). Cyberwords must contain at least one character that is a letter, number or '@'. Isolated hyphens or strings of hyphens alone are not cyberwords.
Any other character is considered punctuation or white space and causes a cyberword break.
Cyberlines may contain cyberwords, punctuation, and spaces in any order, so the last cyberword may not be at the end of the cyberline.
The cyberword you return should have all hyphens removed to simplify rhyme testing.
For example: In the string "Zowie: This is a line of##cyber-poetry## !", "cyberpoetry" is returned. |