Skip to content

Understand metacharacters and escape character #40

Open
@StephenArk30

Description

@StephenArk30

In most languages, the escape character is '\'. Sequences start with an escape character have special meaning, eg: '\n', '\t'.

Metacharacters are escape characters, but often match a group of characters, eg: '\s' matches any whitespace like '\t', '\n'.

So, when we are matching single comment lines in C, we need to use:

\/\/[^\n]*,

instead of

\/\/[^\\n]*

which won't match a line break but a "\n" string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions