1.1.6 Regular expressions in the C expression parser

The C expression parser in DS-5 Debugger supports regular expressions. Regular expressions are a mechanism for examining the contents of strings, and can be used to search variables for strings matching specific patterns. The debugger extends C expression syntax to support regular expressions using the =~ and !~ operators in the style of Perl, as shown in the following examples:

This example evaluates to 1 if the regular expression that uses =~ matches anywhere in the string and 0 if it does not match:

expression =~ regular_expression

This example evaluates to 0 if the regular expression that uses !~ matches anywhere in the string and 1 if it does not match:

expression !~ regular_expression

Where:

expression

is any expression of type char * or char[]. For example, a variable name.

regular_expression

is a regular expression in the form /regex/modifiers or m/regex/modifiers.

For example, if str is a variable of type char*, the following are valid expressions:

str =~ /abc/

((char *) void_pointer) !~ m/abc/i

The exact regular expression syntax supported is described by the Mastering Regular Expressions book in the chapter discussing Java regex support. An exception to this is the parsing of the handling of modifiers. The following modifiers are supported by the debugger:

i
enable case insensitive matching
m
multiline mode (^ and $ match embedded newline)
s
dotall mode (. matches line terminators)
x
comments mode (permit whitespace and comments).
Non-ConfidentialPDF file icon PDF versionARM DUI0452Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.