in reply to How to extract these groups of characters?

I've been trying all sorts of things all day and the closest thing I've managed was this: @words = split(/\s\s\S/, $some_string). This gets me the first three "words" ("joe", "0.00E 000", and "d23")

I'm wondering about that. If I combine the script provided by toolic and your RegExp, then I get
  'joe   0.0000E 000  9.0720E-001      d23     9.0208E-001'
->
  'joe '
  '.0000E 000'
  '.0720E-001    '
  '23   '
  '.0208E-001'

instead of 'joe', '0.00E 000', and 'd23'. (I was trying to understand how your RegExp would result in the output you provided, but it seems it actually doesn't.)

The RegExp suggested by hippo is correct. The magic conditions in your description were 'scientific numbers are separated by exactly one space' and 'values are separated by at least 2 spaces'. (btw. another way to write the required regexp would be /\s{2,}/ )

  • Comment on Re: How to extract these groups of characters?