I want to extract the string after the character '/' in a PostgreSQL SELECT query.
The field name is
If your case is that simple: exactly one
/ in the string, use
SELECT split_part(source_path, '/', 2) FROM movies_history;
If there can be multiple
/, and you want the string after the last one, use
substring() with a regular expression:
SELECT substring(source_path, '[^/]*$') FROM movies_history;
[...] .. encloses a list of characters to form a character class.
[^...] .. if the list starts with
^ it's the inversion (all characters not in the list).
* .. quantifier for 0-n times.
$ .. anchor to end of string.