# tPatternMasking

Masks data that follows a specific pattern and can transform the original data in consistent manner, if needed.

If you need to mask heterogeneous data, you can use the tDataMasking component. For more information, see [tDataMasking](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/tdatamasking).

tPatternMasking replaces pattern-specific and generic data with random characters from a specified range of date and numeric values or a set of named values. The actual data is protected and the substitute data is functional for occasions when it is not advisable to show sensitive real data.

Data will keep looking real and consistent and will remain usable for purposes such as testing and training. The most common data type which may need masking method is where the data contains Personally Identifiable Information (PII) or Sensitive Personal Data (SPD).

tPatternMasking reads a data set row by row and creates a structurally similar but inauthentic version of the data after performing the data masking operations you defined on data fields:

* The component identifies spaces, slashes (/), dashes (-) and points (.) in the input as separators.
* The component preserves the pattern of the input values in the masked output.
* The component generates one row for each input row.

For example, the masked output for 615/67/7489 could be 379/48/1789.

When the input data does not match the pattern you defined, tPatternMasking outputs null.

In local mode, Apache Spark 3.0.x and later versions are supported.

This component is not shipped with your Talend Studio by default. You need to install it using the Feature Manager. For more information, see [Installing features using the Feature Manager](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/install-features-to-talend-studio).

### In this section

* [tPatternMasking Standard properties](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/tpatternmasking-standard-properties)
* [tPatternMasking properties for Apache Spark Batch](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/tpatternmasking-properties-for-apache-spark-batch)
* [tPatternMasking properties for Apache Spark Streaming (deprecated)](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/tpatternmasking-properties-for-apache-spark-streaming)
* [tPatternMasking properties for Apache Spark Structured Streaming](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/tpatternmasking-properties-for-apache-spark-structured-streaming)

**Related tasks**

* [Masking Australian phone numbers](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/masking-australian-phone-numbers "The Job in this scenario uses the tPatternMasking component to mask Australian phone numbers in the same format as the input values.")
* [Masking Medicare beneficiary identifiers](https://help.qlik.com/talend/en-US/components/8.0/data-privacy/masking-medicare-beneficiary-identifiers "Using the tPatternMasking component, you can replace personally identifiable information, such as Medicare Beneficiary Identifiers (MBI), with realistic values in a consistent manner.")