Searching with Regular Expressions

Code Roar supports searching using regular expressions when performing a search using the find dialog or the find first dialog. For example, to find the list of all modules in a verilog file the user can search for the following string:

 

m..ule

 

The above expression replaces the two letters od in the word module with a regular expression wild card .. that will match any two letter combination. Therefore, in addition to matching the word module it would also match the following strings:

midule

madule

musule

 

More examples of searching with regular expressions may be found in Regular Expresssion Search Examples topic.

Supported Syntax

The following regular expression syntax is supported.

 

Regular Expression Character

Description of Character

Example

.

Matches any character

Example of searching using the dot character

(

This marks the start of a region for tagging a match.

Example of searching using the dot character

)

This marks the end of a tagged region.

Example of searching using the dot character

\n

Where n is 1 through 9 refers to the first through ninth tagged region when replacing. For example, if the search string was Fred\([1-9]\)XXX and the replace string was Sam\1YYY, when applied to Fred2XXX this would generate Sam2YYY.

Example of searching using the dot character

\<

This matches the start of a word.

Example of searching using the dot character

\>

This matches the end of a word.

Example of searching using the dot character

\x

This allows you to use a character x that would otherwise have a special meaning. For example, \[ would be interpreted as [ and not as the start of a character set.

Example of searching using the dot character

[...]

This indicates a set of characters, for example, [abc] means any of the characters a, b or c. You can also use ranges, for example [a-z] for any lower case character.

Example of searching using the dot character

[^...]

The complement of the characters in the set. For example, [^A-Za-z] means any character except an alphabetic character.

Example of searching using the dot character

^

This matches the start of a line (unless used inside a set, see above).

Example of searching using the dot character

$

This matches the end of a line.

Example of searching using the dot character

*

This matches 0 or more times. For example, Sa*m matches Sm, Sam, Saam, Saaam and so on.

Example of searching using the dot character

+

This matches 1 or more times. For example, Sa+m matches Sam, Saam, Saaam and so on.

Example of searching using the dot character