- Issue created by @baikho
- @baikho opened merge request.
Adding a preg_match
plugin for extracting substrings using regular expressions.
This is a common need during migrations; for example, extracting values enclosed in characters or matching a known pattern. Without a preg_match
plugin, users must write custom callbacks or process plugins for a simple operation.
1. Attempt to extract part of a source value using regex.
2. Use str_replace
with regex: true
, but realize it only replaces content.
3. No preg_match
plugin exists to extract matching values.
Add a preg_match
process plugin that uses preg_match()
to extract matched content.
Configuration options:
Example usage:
process:
extracted_value:
plugin: preg_match
source: source_field
pattern: '/some-pattern/'
group_index: 1
Plugin/migrate/process/PregMatch.php
N/A
N/A
N/A
Active
6.0
Plugins