Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem Stripping line returns
#1
I have been trying to use a regex to clean the contents of the clipboard. When copy and pasting from Acrobat, the selection many times has a carrige return at the end of each line. Want to strip the carriage returns at the end of the line, but I want to preserve the carriage returns at the beginning and end of the clipboard text

I have tried many of the combinations below. To preserve actual paragraph returns I wanted to convert the double carriage returns with a placeholder, then strip all of the other returns, and then convert the placeholders to single carriage returns.

any guidance appreciated
Jeff

======================================================
ClearOutput
int hwnd=win("Adobe Acrobat")
key Cc
_s.getclip
_s.replacerx("(\x0D\x0A){3,}" "qqqq" 1|2)
_s.replacerx("(\x0D\x0A){3,}" "$3" 1|2)
_s.replacerx("\x0D\x0A\x0D\x0A.*")
_s.replacerx("(\x0D\x0A){1,}" "qqqq" 1|2)
_s.replacerx("(\x0D\x0A){1,}" "" 1|2)
_s.replacerx("\x0D\x0A*")
_s.replacerx("(qqqq)""(\r\n)")
_s.setclip()
out _s
#2
removes empty lines
Macro
Code:
Copy      Help
out
_s=
;one
;two
;
;three
;
;
;four
;
;
;
;five
;

_s.findreplace("[][]" "[]" 8)

out _s
#3
THX ort the blank line code.

I stillhave problem o stipping the extra carriage returns at the end of each line, while preserving the double spacing between paragraphs. Here is an example of my problem;

==========Original Formating ===========
You have a bunch of sub-directories.¶


You'd like to consolidate into one but don't want to do the mouse work or write a batch script. ¶
Suction will help you condense your directories.¶

There are two ways to interact with Suction.¶
You can launch the Suction executable as a portable application and use the drag and drop interface¶
the drop box is seen in the background of the screenshot here—and all dropped folders and their recursive folders and files will be transferred to the ¶
consolidation folder you have specified. ¶

==========Desired Formating ===========
You have a bunch of sub-directories.
You'd like to consolidate into one but don't want to do the mouse work or write a batch script. Suction will help you condense your directories.¶

There are two ways to interact with Suction.
You can launch the Suction executable as a portable application and use the drag and drop interface the drop box is seen in the background of the screenshot here—and all dropped folders and their recursive folders and files will be transferred to the consolidation folder you have specified. ¶

Im truggling to take advantage of the RegEx function by using the "\r\n" pattern to represent the "¶"

A ideas
#4
_s.findreplace("[][][]" "[][]" 8)


Forum Jump:


Users browsing this thread: 1 Guest(s)