Skip to content

Help with regex matching syntax #1753

Answered by BurntSushi
thivmcthiv asked this question in Q&A
Discussion options

You must be logged in to vote

Note: I edited your comment to use backticks instead of double quotes around your regexes. Without those, the * characters are usually interpreted as Markdown, which means it's rendered in a way you don't expect.

Note: I converted this to a discussion question since it seems more like a support question rather than a bug report or a feature request.

As for your question, it looks like you're asking for help with constructing the regex itself? And not the actual code? If so, you're pretty close. The * itself is a unary operator, meaning that it takes a single argument. In regex syntax, the * applies to the "thing" preceding it. In your case, s*nx, the * applies to the s, which modifies it …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Comment options

You must be logged in to vote
1 reply
@BurntSushi
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1753 on December 06, 2020 12:24.