# Regex

A regex, or regular expression, is a sequence of characters that defines a search pattern. It is used for pattern matching within strings, allowing you to find specific text based on defined rules.

To learn how regex works take a look at this site [regexone.com ](https://regexone.com/)or if you are already familiar you can also check this online utility: [regex101.com](https://regex101.com/) (make sure to select Java on the left side)

## Copier filter

The copier filter can be used to allow only specific trades based on the **comment** or **magic number**. Here are some examples:

<table><thead><tr><th width="174">Type</th><th width="122">Regex</th><th>Description</th></tr></thead><tbody><tr><td>Comment</td><td>my EA</td><td>It copies only the trades that have "my EA" in the comment field</td></tr><tr><td>Comment</td><td>^my EA</td><td>It copies only the trades that have "my EA" in the <strong>beggining</strong> of the comment field</td></tr><tr><td>Comment</td><td>^my EA$</td><td>It copies only the trades that have <strong>exactly</strong> "my EA" in the comment field</td></tr><tr><td>Magic number</td><td>5</td><td>It copies only the trades that have "5" as magic number. Pay attention that "15" will also be copied.</td></tr><tr><td>Magic number</td><td>^5$</td><td>It copies only the trades that have "5" as magic number. </td></tr></tbody></table>

### Remarks

* Regex is **case sensitive**
* If you have multiple filters, they will be handled with the **OR operator**

## Symbol mapping

Here are some examples regarding the [symbol mapping](https://docs.metacopier.io/features/basic-features#symbol-mapping) and broker selection:

<table><thead><tr><th width="242">Regex</th><th>Description</th></tr></thead><tbody><tr><td>ICMarketsSC</td><td>The mapping is valid for all brokers that have ICMarketsSC in the broker name. This includes all live and demo brokers.</td></tr><tr><td>^ICMarketsSC-Demo02$</td><td>The mapping is valid for all brokers that matches <strong>exactly</strong> ICMarketsSC-Demo02</td></tr></tbody></table>

### Remarks

* Regex is **case sensitive**

## Permitted symbols

Here are some examples regarding the permitted symbols feature:

<table><thead><tr><th width="187">Type</th><th>Regex</th><th>Description</th></tr></thead><tbody><tr><td>Whitelist</td><td>eurusd</td><td>Only orders that includes "eurusd" and "EURUSD" (case insenstive) will be copied</td></tr><tr><td>Whitelist</td><td>eur</td><td>All order that includes "eur" or "EUR" (case insensitive) will be copied</td></tr><tr><td>Whitelist</td><td>^eurusd$</td><td>Only orders that matches <strong>exactly</strong> "eurusd" and "EURUSD" (case insenstive)  will be copied</td></tr><tr><td>Blacklist</td><td>xau</td><td>All orders except orders that includes "xau" or "XAU" (case insenstive)  will be copied</td></tr></tbody></table>

### Remarks

* Regex is **case insensitive**
