kokke / kokke/tiny-regex-c

Understand metacharacters and escape character

Open
#40 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

In most languages, the [escape character](https://en.wikipedia.org/wiki/Escape_character) is '\\'. Sequences start with an escape character have special meaning, eg: '\n', '\t'.

[Metacharacters ](https://en.wikipedia.org/wiki/Metacharacter)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.

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named in the issue. Review the repository's existing explanation or examples of C regular-expression patterns, then determine whether the escape-character distinction should be documented or corrected; done means the explanation clearly distinguishes a newline from the literal "\\n" sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.