Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match ASCII control characters #257

Closed
zigfreid5 opened this issue Mar 13, 2015 · 2 comments
Closed

Match ASCII control characters #257

zigfreid5 opened this issue Mar 13, 2015 · 2 comments

Comments

@zigfreid5
Copy link

I need to match control characters found in ascii characters 0-33. Is there a way to use these in the "TEST STRING" textarea?

@nhahtdh
Copy link
Collaborator

nhahtdh commented Mar 19, 2015

You shouldn't test those character on an online-test anyway: https://regex101.com/r/yP2qV8/2

The trick is to open the console, loop through the characters from 0 to 31, concatenate them and output to console, then copy it into the field. Note that this trick doesn't work with \r and \0. In Firefox, \r will just get converted to \n, and \0 kind of "terminates" the string so nothing is copied. In Chrome, the same thing happens, but \r\n sequence will be converted into a single \n instead of two like in Firefox's case.

Another trick is to programmatically set the regex string $("#regex_string")[0].value from the console. This trick allows you to test \0, but not \r. In Firefox and Chrome, \r\n or lone \r will be converted to just \n.

@firasdib
Copy link
Owner

I agree with @nhahtdh

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants