Skip to main content

Migrate Process Extract Regex

Submitted by daniel on

Migrate Process Extract Regex

This module provides a Migrate process plugin to enable you to parse and extract a $needle (string) from a $haystack (string). This will either return $match[1] or the original $haystack if no match is found.

Use Case

This migrate_process_extract_regex module is useful where developers are handling remote images with the remote_steam_wrapper module. Sometimes remote media assets (pictures etc.) do not contain a valid query string and will fail to import.

e.g.

This is handled fine:

https://www.ilfordrecorder.co.uk/resources/images/17245750/?type=og-image

However, this does not work on other images that are appended with a query e.g.

https://www.telegraph.co.uk/content/dam/news/2023/02/03/TELEMMGLPICT000324170962_trans_NvBQzQNjv4Bq1V8_3oXt_XBWwkgI1jrKEeDSV_dXcWbrTlT5gho2zKg.jpeg?impolicy=logo-overlay
 

Therefore, to avoid exceptions and to ensure the image can be handled by remote steam wrapper, it may be better to strip the query string as part of the migration process.

 

 

Date Created
7 months ago