Jump to content
Ketarin forum
  • Announcements

appyface

Carriage Return/Linefeed or Linefeed/Carriage Return?

Recommended Posts

appyface   

Using Ketarin 1.8.7.

 

I hope someone can help to explain what I'm seeing.

 

First, please look at this example:

 

1. Create ketarin variable "vers", load this URL: http://www.piriform.com/ccleaner/download

2. Regex: release notes.*?<strong>.*?v(.{1,10})\n

 

This (today) populates "vers" with 5.28.6005

Note the linefeed match.

 

 

Now, copy/paste the page source directly from the Ketarin window into a hex editor or other editor that can visualize carriage returns and linefeeds.

 

When I paste this source into EditPad Pro (my usual editor) and display it hex mode, what follows the 5.28.6005 in the source is a x0D x0A -  carriage return/linefeed.

 

I am assuming Ketarin is correct and the source really is LF/CR.  Or is Ketarin mis-interpreting the source?

 

I've not had any problem in the past with EditPad Pro showing terminators incorrectly, it supports all the variations, but I'll try another hex editor anyway.

 

Assuming for the moment that EditPad Pro isn't at fault here either, could windows be converting the terminators in the clipboard to standard windows CR/LF sequence?  I'm using Win 10 Pro.  Thoughts?

Share this post


Link to post
Share on other sites
shawn   

Windows sometimes converts LF+CR to CR+LF when copied to the clipboard.

 

That said, I tested the URL in several different clients and got CRLF in all of them. 

 

That said, regexp "\n" can match not only CR but all combinations of CRLF, LFCR, LF and CR. It can also match instances of x09 (tab) and x0B (vertical tab) and \u0085 (unicode new line). It doesn't merely mean "new line", but "characters commonly interpreted as a new line", based on the specific RegExp client.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×