0

My SQL request:

SELECT Path FROM Media m join Article_Image am on m.id=am.mediaid where am.articleid=609;

The value in the Path column:

/uploads/dddef9788caab36fcfd0ce05c84373e3.jpeg

I need to extract dddef9788caab36fcfd0ce05c84373e3 using regular expression.

1 Answer 1

1

MySQL does not have any native regex extraction support. But we can use SUBSTRING_INDEX instead:

SELECT
    SUBSTRING_INDEX(SUBSTRING_INDEX(PATH, '/', -1), '.', 1)
FROM yourTable;

Demo

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

1 Comment

I need to wait 8 minutes

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.