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!

2
  • 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. Commented Dec 7, 2010 at 19:28
  • Ref: stackoverflow.com/questions/986826/… Commented Dec 7, 2010 at 19:29

2 Answers 2

0

Try this:

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

Your example on Rubular.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, but my issue isn't finding the string so much as doing something with that string.
What would you like to do with it?
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.