A
A
Anton2017-08-19 15:28:47
SQL
Anton, 2017-08-19 15:28:47

How to cut a word from a string between the last slash and a dot?

Good afternoon!
For example, there is a line: /files/pages/test_image.jpeg Can
you please tell me how to cut out only the name of the image from the line, without its extension?
The variant through regular expressions interests: to cut out a word between the last slash and a point.
PS If there is a great option without using regular expressions and explode(), then I would be glad to see them.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
NewDevLab, 2019-04-18
@NewDevLab

SELECT customer_id, min(counts) FROM (....)

N
nozzy, 2019-04-18
@nozzy

SELECT t1.customer_id, MIN(t1.count)
    FROM (
         SELECT customer_id, status, count(*) as count
         FROM requests
         GROUP BY customer_id, status
         HAVING status = "to work"
     ) AS t1

A
Alexander Kovalev, 2017-08-19
@Yadalay

You can also do it without regularity:

$path = "/files/pages/test_image.jpeg";
  $ext = pathinfo($path, PATHINFO_EXTENSION);

  $file = basename($path, "." . $ext);

  echo $file;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question