Navigation:  Macroses >

Regular Expressions

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text

 

Parse with regular expression

Pass a string, that needs to be parsed, to the macro, set a regular expression, specify the coincidence number or all to get all the results.

 

Example 1

 

Parsed string

abc qwerty 12345

Regular expression

\w{5}

Number of coincidence

1

 

Macro

{-RegExp.RegExp-|-abc qwerty 12345-|-\w{5}-|-1-}

 

Result

12345

 

Example 2

 

Parsed string

abc qwerty 12345

Regular expression

\w{5}

Number of coincidence

all

 

Macro

{-RegExp.RegExp-|-abc qwerty 12345-|-\w{5}-|-all-}

 

Result

qwert

12345

 

Replace all strings that match a specified regular expression

Pass a string, where the replacement is needed, to the macro, indicate what symbols must be replaced and what must be inserted instead of them with the help of regular expressions.

 

Example

 

Input string

abc   ab  abcd    abcde

Regular expression

\s{2,}

At that replaced

here we put a gap

 

Macro

{-RegExp.Replace-|-abc   ab  abcd    abcde-|-\s{2,}-|- -}

 

Result

abc ab abcd abcde

 

Split by a regular expression match

Pass a string to the macro with the help of a regular expression. Specify the division symbol and the number of the required substring.

 

Example

 

Input string

login - password

Regular expression

\W{3}

Number of substrings

1

 

Macro

{-RegExp.Split-|-login - password-|-\W{3}-|-1-}

 

Result

password

 

Convert string to the regular expression

This macro processes all the special symbols in the output string so that they are percieved just as symbols.

 

Example

 

Input string

\w\d*

 

Macro

{-RegExp.Escape-|-\w\d*-}

 

Result

\\w\\d\*