Hide Table of Contents

Reference Information: Regular Expression Syntax

Regular expressions can be used in the Filters workshop and the Search pane, as well as for the DisableMatchingProperties advanced setting. This topic lists the regular expression syntax and abbreviations.

This page discusses:

Regular Expression Syntax

This table lists the meta-characters that you can use as regular expressions.

Metacharacter Meaning
. Matches any single character.
[ ] Indicates a character class. Matches any character inside the brackets (for example, [abc] matches "a", "b", and "c").
^ If this meta-character occurs at the start of a character class, it negates the character class. A negated character class matches any character except those inside the brackets (for example, [^abc] matches all characters except "a", "b", and "c").

If ^ is at the beginning of the regular expression, it matches the beginning of the input (for example,^[abc] will only match input that begins with "a", "b", or "c").

- In a character class, indicates a range of characters (for example, [0-9] matches any of the digits "0" through "9").
? Indicates that the preceding expression is optional: it matches once or not at all (for example, [0-9][0-9]? matches "2" and "12").
+Indicates that the preceding expression matches one or more times (for example, [0-9]+ matches "1", "13", "456", and so on).
*Indicates that the preceding expression matches zero or more times.
??, +?, *? Non-greedy versions of ?, +, and *. These match as little as possible, unlike the greedy versions that match as much as possible (for example, given the input "<abc><def>", <.*?> matches "<abc>" while <.*> matches "<abc><def>").
( ) Grouping operator. Example: (\d+,)*\d+ matches a list of numbers separated by commas (for example, "1" or "1,23,456").
{ } Indicates a match group.

Escape character: interpret the next character literally (for example, [0-9]+ matches one or more digits, but [0-9]\+ matches a digit followed by a plus character). Also used for abbreviations (such as \a for any alphanumeric character; see the following table).

If \ is followed by a number n, it matches the nth match group (starting from 0). Example: <{.*?}>.*</\0> matches "<head>Contents</head>".

$ At the end of a regular expression, this character matches the end of the input (for example,[0-9]$ matches a digit at the end of the input).
| Alternation operator: separates two expressions, exactly one of which matches (for example, T|the matches "The" or "the").
! Negation operator: the expression following ! does not match the input (for example, a!b matches "a" not followed by "b").


This table lists supported abbreviations, such as \d instead of [0-9].

Abbreviation Matches
\a Any alphanumeric character: ([a-zA-Z0-9])
\bWhite space (blank): ([ \\t])
\cAny alphabetic character: ([a-zA-Z])
\dAny decimal digit: ([0-9])
\hAny hexadecimal digit: ([0-9a-fA-F])
\nNewline: (\r|(\r?\n))
\qA quoted string: (\"[^\"]*\")|(\'[^\']*\')
\w A simple word: ([a-zA-Z]+)
\z An integer: ([0-9]+)

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   Reference Information: Regular Expression Syntax
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: SOLIDWORKS Composer 2024 SP02

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.