Wildcards & Regular Expressions

A regular expression is a string containing wildcards which is used to match items in an existing set of strings. For example, if you wish to perform the same operation on many items (say palettes) which have similar names, then you can choose to use regular expressions to specify those of interest.

Regular expressions (sometimes called regexes) are used in various tools throughout Impact, and are used widely in computing generally. There are many good online sources of information, but be aware that there are subtle differences between different implementations. 

A good way to experiment with regular expressions is to create/open a drawing which has a number of different palettes in use. Go to the Visibility page of the Impact Explorer, change the pull-down list to Palettes and right-click in the palettes list. Using the Select By Regular Expression option, you can quickly select/deselect palettes of a similar name in this list. 

Special Characters

The special characters are as follows:

  • ^ matches start of line
  • $ matches end of line
  • . (dot/point) matches any character except new line
  • * matches any, zero or more characters
  • + matches one or more characters
  • ? matches the preceding element zero or one times
  • [ ] matches one from any character in the set (ranges can be indicated with a dash)
  • \ matches the next character literally

Examples

The following examples demonstrate the use of some of the special characters:

  • [abc] matches a or b or c
  • [a-z] matches any one lower case letter
  • [a-z]* matches zero or more lower case letters
  • [a-z]+ matches one or more lower case letters
  • ^xy?z matches any string beginning with xyz or xz
  • [A-Z][a-z]* matches any capitalised word
  • \? matches a question mark
  • .*pt matches Cut 2pt, Crease 2pt etc.
  • Zipper$ matches Zipper but not Zipper Left or Zipper Right
  • [Tt]ight matches either Tight or tight

Special Codes

You can use the following special codes:

  • \b = backspace
  • \e = escape
  • \f = formfeed
  • \n = new line
  • \r = carriage return
  • \t = tab
  • \xddd = hex code for character
  • \^C = control code (for example CTRL-C)

Further Reading

There are many online guides and references available, for example here, here and here. These are external websites, and so Arden Software is not responsible for the content of these pages.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

You may like to read -