Symbolic representation of Return | \x0a vs. other

I'm trying to verify my code.

Here is a regex check on it with out 0xa:

As you can see at some places where there is a return character the regex does not match b.c. 0xa is used for the return character.

Here is a regex check inlcuding 0xa:

As you can see it is all included.

In short my .js includes these characters:

[\x0a\x20-\x7e]

However I am concerned as to why it sometimes uses a return as:

\\ the other return character ( have not verified yet )

and sometimes it uses a return as:

\x0a

Related

http://en.wikipedia.org/wiki/ASCII

Answers


I was surprised that it look like it groups the rows together, but it has to do with the star in your regexp. Change your regexp to [\x20-\x7e]+. Using the plus sign (one or more matches) instead of star (zero or more matches) I think you get the expected result.

If you want to see whats really is in the inputText-field on regexpal, open up the console in your browser and run document.getElementById('inputText').value.replace(/[^\x20-\x7e]/g,function(a){‌​a = a.charCodeAt(0).toString(16); return '\\u0000'.slice(0,6-a.length) + a;}); and you will get a true representation of the string.

Pretty print:

document.getElementById('inputText').value.replace(
  /[^\x20-\x7e]/g,
  function (a){‌
    ​a = a.charCodeAt(0).toString(16);
    return '\\u0000'.slice(0,6-a.length) + a;
  }
);

Need Your Help

Specifying First Nav ul With jQuery

jquery html

I'm trying to use a jQuery plugin called menuFlip ONLY on the first ul for my navigation menu. but for some reason, no matter what I do, it applies menuFlip to all of the sub-menu's too.

Change Minimizing Visual Effect

c# .net forms windows-xp effects

I've created an app with invisible form. (Opacity = 0 or Visible = false ShowInTaskbar = false)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.