Re: RX.Tool scope limited to 1 line ?
Chris Glur wrote:
This most frustrating [but essential] Tool !
Peter E. wrote:
Babel and Regul written by Gerard Meunier are far more sophisticated. Try them. RX is for simpler tasks.
System.Directory SrcModls:Babel* == 36 files BAK:Regul* == 16 files I don't want to 'get married' ! I want something that fits into to the minimalist N-O style. Only if someone confirms that Babel/Regul can already do what I've specified, will I invest resources on a new BIG utility. I can't remember why I aborted previously after downloading it. If I [or hopefully someone else] uses it & has some examples to list on 'the wiki' that would be good.
When ever I try to program it after 6 months away, I need a 2 hour refresher course.
Two hours spent studying Regul will be a better investment.
I've always understood that the 'scope' is limited to a single line. Ie. that searching & replacing cannot be done over line boundries.
True as far as I know for RX. Regul does not have that limitation.
This seems not to be the case. Since there would then be no reason to have in the recognised 'syntax': " c : carriage return "
That allows you to match the whole line to the end rather than a substring of the line.
OK, it's equivalent to EOT/F in a text/file. }
Can this utility eg. find and remove all such 4 lines from a marked frame:
<anyString> <space> "cat" <anyString> <anyString for line 2> <anyString for line 3> <anyString> <space> "dog"
Easily done with ET. Just mark the text with MR. ET.Search to the mark. Replace with a CR. Repeat or use RepAll.
No. I've got 5 Texts per day, each with many repeated 'patterns' which I want to delete by just marking the text and hitting ET.Do FixCatDog. Ie. by just programming 3 lines in a script. An example of a very common requirement is a lot of inet fetched files having all lines with 3 leading spaces, which causes it to overflow my favoured display width. BTW my first [and last] exercise in N-O was to remove the unwanted fields of newsHeaders. The algorithm seems to be overly complex: 1. use the scanner the find the good-lines & note the <CR> count to an array. 2. use the reader to find the char-position of the end/start of each good-line, from the saved <CR> counts. 3. use the found char-positions to delete text before and between good-lines. Email headers are becoming absurdly large these days too ! The same data/table-driven utility, would cleanup the Email headers also. Which relates to Thomas' post where he didn't answer my question but claimed that the scanner is for input and the caret is for output. I disagree: in TTY days the 'display' was output-only, but for N-O the display is the major part of the INPUT which gives N-O its power. ===================================== Aubrey.McIntosh wrote:
I found that the three search strings here work separately, but when I try to concatenate them, I receive a line too long error. The next step might be to do a replace of the complicated strings with some relatively simple constant string in 1 pass, so that RX doesn't get lost.
dog cat frodo lives this and that more nonsense house dog
dog cat2 gandolf dies this and that more nonsense house dogs
dog cat frodo lives house dog
dog cat frodo lives this and that more nonsense house dog
dog cat2 frodo lives this and that more nonsense house dogs
{ i | t | " " } == some(alfanum OR <TAB> OR <space> ) Perhaps "~c" =anything but a lineEnd is better, to also see special chars. But that still doesn't fix it.
RX.Search
RX.SetSearch { i | t | " " } X1 " cat" { i | t | " " } c RX.SetSearch { i | t | " " } c RX.SetSearch { i | t | " " } " dog" c
I think a lot [of what to avoid] can be learned from RX*. RX.Tool is NOT a tool/utility, but a game for exercising agile minded school-boy tricks. Thanks, == Chris Glur.
participants (1)
-
Chris Glur