I had a look at GetWords today, and BC seems to have introduced a few things which can improve GetWords. I've always struggled with regex, so I was a pretty happy when this worked...

function YourAddOn:GetWords(str)
  local retVal = {};
  for nxtW in string.gmatch( msg, "(%p*%w*%p*%w+)%s*" ) do
    table.insert( retVal, nxtW );
  return( retVal );

That regex/pattern keeps integral punctuation with a word, as well as leading punctuation. So...

  • we've
  • sub-sub==section
  • $3.50
  • _under-score
  • #->a

... would remain intact, but input such as...

  • yes...
  • pre-male,
  • Hey!!
  • ?Who?

...would have the trailing punctuation removed.

But yeah, regex isn't one of my string points, so maybe someone could come up with a cleaner way to acheive that part. It's seems a bit too convoluted.

Kord 13:21, 4 March 2007 (EST)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.