question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect test inputs produced for RegEx word character

See original GitHub issue

Specifying a pattern using a word character (e.g. ^[\w\-.~]+$) causes invalid generated test inputs such as ŏŏşNÇţā3MKÁŔßïõŜàĆXń²ńÖÞ.

Replacing the above RegEx with ^[A-Za-z0-9_\-.~]+$ fixes this issue, so I assume that CFN CLI has a bug specifically related to \w.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kddejongcommented, Oct 28, 2022

I may also argue that according to JSON Schema docs we shouldn’t be allowing regex patterns that use \w

0reactions
kddejongcommented, Nov 2, 2022

According to ECMA 262,

  • \w, \W, \b, \B, \d, \D, \s and \S flags in regex should be ASCII based not unicode
  • Unicode is the default in python so we should switch to ASCII (minus the service flipping with a flag)

More details: https://docs.python.org/3/library/re.html#re.ASCII https://262.ecma-international.org/5.1/#sec-15.10.2.12 http://json-schema.org/understanding-json-schema/reference/regular_expressions.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checking input string for the invalid character(s) using regex
Your Regex will encounter an invalid character, then start trying to match again at the next character (which succeeds).
Read more >
Everything you need to know about Regular Expressions
After reading this article you will have a solid understanding of what regular expressions are, what they can do, and what they can't...
Read more >
Input Validation using Regular Expressions - Security Innovation
Learn how to properly build regular expressions to ensure you're getting the most out of your input validation routines.
Read more >
Best Practices for Regular Expressions in .NET - Microsoft Learn
Thoroughly test your regular expression using invalid, near-valid, and valid input. You can use Rex to randomly generate input for a ...
Read more >
Regular Expressions :: Eloquent JavaScript
A regular expression consisting of only nonspecial characters simply represents that sequence of characters. If abc occurs anywhere in the string we are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found