0

I need to extract a few fields of data from many lines of text. The data I am looking for is always in the same format ("from #.#####.##########") but it always contains different data. I know I can use regex to determine if that pattern is met... but I know the pattern is met. I want to know where in the string the pattern is met so that I can substring it out of there. Is that possible?

So a few of the lines of text might look like...
Oh, hello there. Blah blah blah. from 1.12345.1234567890 doopeedoo whoop!
Lay tee dah good sir! from 3.98766.123487650 and some other stuff!

Thanks in advance!

Nate
  • 2,035
  • 8
  • 23
  • 33
  • 1
    As it goes, I'm not sure MySQL has a function for this, all the `REGEXP` commands appear to be boolean in return value. – Orbling Dec 07 '10 at 19:28
  • Ref: http://stackoverflow.com/questions/986826/how-to-do-a-regular-expression-replace-in-mysql – Orbling Dec 07 '10 at 19:29

2 Answers2

0

Try this:

/from \d+\.\d+\.\d+/

Your example on Rubular.

detunized
  • 15,059
  • 3
  • 48
  • 64
0

As Orbling noted, there doesn't seem to be a function for returning the string, only telling if it exists or not. I ended up using wild substring and index search functions.

Nate
  • 2,035
  • 8
  • 23
  • 33