0

I am trying to get year (yyyy) from text/string in the column "title" but for some reason can't get following query to work:

select substring(title,LOCATE(REGEXP '[(][0-9]{4}[)]',title),4) from videos

title column has following values:

abc abc 2001 abc
xyz (2002) xyz

Any assistance will be appreciated.

4
  • REGEXP can only be used to match patterns, not extract them. You will need to find another way. MySQL may not be the best place to scrub your data. Commented Jan 11, 2017 at 1:06
  • @BillKarwin Most of the answers in your link aren't relevant to this question. Commented Jan 11, 2017 at 1:09
  • Why is this tagged tsql? Commented Jan 11, 2017 at 1:10
  • @BillKarwin your duplication is not relevant Commented Jan 11, 2017 at 1:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.