Title: WP_MatchesMapRegex::__construct
Published: April 23, 2015
Last modified: August 20, 2026

---

# WP_MatchesMapRegex::__construct( string $subject, array $matches )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#related)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#wp--skip-link--target)

constructor

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#parameters)󠁿

 `$subject`stringrequired

subject if regex

`$matches`arrayrequired

data to use in map

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#source)󠁿

    ```php
    public function __construct( $subject, $matches ) {
    	$this->_subject = $subject;
    	$this->_matches = $matches;
    	$this->output   = $this->_map();
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-matchesmapregex.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-matchesmapregex.php#L50)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-matchesmapregex.php#L50-L54)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/__construct/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_MatchesMapRegex::_map()](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/_map/)`wp-includes/class-wp-matchesmapregex.php` |

do the actual mapping

  |

| Used by | Description | 
| [WP_MatchesMapRegex::apply()](https://developer.wordpress.org/reference/classes/wp_matchesmapregex/apply/)`wp-includes/class-wp-matchesmapregex.php` |

Substitute substring matches in subject.

  |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_matchesmapregex%2F__construct%2F)
before being able to contribute a note or feedback.