Regex Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm trying to extract all words from a string of text but am running into
'issues' which I would appreciate help with.

I have string and whitespace seperates words. There WILL be mulitple space
characters between each word. e.g

Hello 123 world % $1300 456

I've tried all sorts of regexes to extract just the words, but I'm also
getting matches on spaces where multiple spaces separate a word. Also, the
'word' may be non-alpha-numeric...e.g. contain % $ etc. (so \b doesn't work!)

This expression...

(?<=\s*)\S*

....is the nearest I can get, but it does match the blank spaces as well as
an individual match (try it on the above string!) OK..I could go through my
results and extract these, but I'd like something slicker!

Can anyone suggest any good regex to extract just the words without
extracting any spaces?

Help is MUCH appreciated

Thanks

Jon
 
Back
Top