Skip to main content Skip to complementary content

Creating a new pattern from the Pattern Test View

You can create your own customized patterns from the Pattern Test View. The advantage of creating a pattern from this view is that you can create your customized pattern based on an already tested regular expression.

All you need to do is to customize the expression definition according to your needs before saving the new pattern.

Before you begin

You have selected the Profiling perspective.

Procedure

  1. In the DQ Repository tree view, expand Libraries > Patterns > Regex and double-click the pattern you want to use to create your customized pattern.
    The pattern editor opens in Talend Studio.
    Overview of the Pattern editor.
  2. Click Test next to the definition you want to use as a base to create the new pattern.
    The Pattern Test View is opened on the definition of the selected regular expression.
    Overview of Pattern Test View.
  3. Optional: Enter a test string in the Test Area, to test the regular expression.
  4. Click Create Pattern to open the New Regex pattern wizard.
  5. In the Name field, enter a name for this new regular expression.
    Information noteImportant:

    Do not use the following special characters in the item names: ~ ! ` # ^ * & \\ / ? : ; \ , . ( ) ¥ ' " « » < >

    These characters are all replaced with "_" in the file system and you may end up creating duplicate items.

  6. If required, set other metadata (Purpose, Description, and Author) in the corresponding fields and click Next to proceed to the next step.
    The definition of the initial regular expression is already listed in the Regular expression field. In this example:'^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$'.
  7. Customize the syntax of the initial regular expression according to your needs. The regular expression definition must be surrounded by single quotes.
    Information noteNote:

    For the PostgreSQL database, regular expressions are not compatible among the database different versions.

    If you want to use the regular expression with PostgreSQL version 9.1 or greater, you must either:
    • in the PostgreSQL database configuration, set the standard_conforming_strings parameter to off and write double backslashes in the definition, or
    • in the Regular expression field in the wizard, use a single backslash in the expression definition.

    For further information about PostgreSQL regular expressions, select Window > Show View, expand Help and then select Bookmarks.

    Information noteNote: From Talend Studio 8.0. R2024-03 onwards, only the PostgreSQL versions 12 and later are supported. The earlier versions have been removed.
  8. From the Language Selection list, select the database in which you want to use the new regular expression.
  9. Click Finish to close the wizard.

Results

A subfolder for the new pattern is listed under the Regex folder in the same file of the initial regular pattern. The pattern editor opens on the pattern metadata and pattern definition.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!