Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

ntb-clips · The NoteTab Clips List

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 23446 - 23475 of 23883   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#23446 From: Axel Berger <Axel-Berger@...>
Date: Sun Nov 25, 2012 2:57 pm
Subject: Re: [Clip] Testing for EMPTY document to EXIT Loop?
absalom_nemini
Send Email Send Email
 
Jeffery wrote:
> ^!Select ALL
> ;(How do I test to see if the  focused doc is empty,
> and if so EXIT the  clip?)

That's an easy one. Lots of my clips need to run differently depending
on whether something is selected or not. Sometimes the ^& does that on
its own, sometimes I have to be more explicit:

^!If ^$GetSelSize$ > 3 dorun
^!Goto END
:dorun

Axel

#23447 From: "Rodney" <rodney.cook6@...>
Date: Sun Nov 25, 2012 11:31 am
Subject: Re: My trig does not work in version 7
cook.rodney...
Send Email Send Email
 
It is actually version 7.1 that I have and after reading the 'What's new' file,
I think it could be changes made after version 7 that are giving me problems.
Basic trigomometry is finding arcs or points on a circle and I am not convinced
that version 7.1 can do this. I sicerely hope that someone can prove to me that
it can.



--- In ntb-clips@yahoogroups.com, "Rodney" <rodney.cook6@...> wrote:
>
> I have been using the following clip for the past seven years without any
problems. Now I have upgraded to version 7 it does not work. Sometimes it works,
but it is dependant on the configuration of points and angles. any suggestions
for making it work in version 7 would be most appreciated.
>
>
> ^!Set %H24%=^?{Center of circle in X=^%H24%}; %H25%=^?{Center of circle in
Y=^%H25%}; %H23%=^?{Radius of circle=^%H23%}; %H11%=^?{Number of points=^%H11%};
%H1%=^?{Angle to first point=^%H1%}
>
> ^!IfCancel Exit
>
> ^!Set %H19%=1
> :Start
> ^!if ^%H19% > ^%H11% Stop
> ^!Set %H30%=^$Calc((^%H19%-1)*360/^%H11%+^%H1%;3)$
> ^!Set %X%=^$Calc(Cos(^%H30%*Pi/180);3)$
> ^!Set %Y%=^$Calc(Sin(^%H30%*Pi/180);3)$
> ^!Set %X%=^$Calc(^%X%*^%H23%+^%H24%;3)$
> ^!Set %Y%=^$Calc(^%Y%*^%H23%+^%H25%;3)$
> X^%X% Y^%Y%^%NL%
> ^!Set %H19%=^$Calc(^%H19%+1)$
> ^!GoTo Start
> :Stop
>

#23448 From: "flo.gehrke" <flo.gehrke@...>
Date: Sun Nov 25, 2012 3:58 pm
Subject: Re: Testing for EMPTY document to EXIT Loop?
flo.gehrke
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "Jeffery" <jeff@...> wrote:
> How do I test to see if the  focused doc is empty, and if so EXIT
> the  clip?

^!IfFalse ^$GetTextSize$ Exit

Regards,
Flo

#23449 From: Jeffery Scism <jeff@...>
Date: Sun Nov 25, 2012 5:28 pm
Subject: Re: [Clip] Testing for EMPTY document to EXIT Loop?
scismgenie
Send Email Send Email
 
On 11/25/2012 6:57 AM, Axel Berger wrote:
> ^!If ^$GetSelSize$ > 3 dorun
> ^!Goto END
> :dorun
Thanks I'll run it on the NEXT directory I do.


[Non-text portions of this message have been removed]

#23450 From: Axel Berger <Axel-Berger@...>
Date: Wed Nov 28, 2012 2:08 pm
Subject: Bug: Character Set again
absalom_nemini
Send Email Send Email
 
The half baked charset functions in NTP are really beginning to get to
me. I've still not upgraded from version 7.01, so should the following
be fixed, please tell me off:

I am writing a normal document complete with umlauts in standard
cp-1252. Now I want a small section in Russian. No problem, I save, load
as "Code page: Cyrillic", set my keyboard to Russian and happily type
away. (N.B: changing the codepage in the middle of a text is no problem
for LaTeX, you just say "\inputencoding{x-cp1251}" and go on.) So far,
so perfect.

Now, having finshed that section I want to go on as before. So again I
save the document, switch the keyboard back to German, load the document
as "Code page: Western" and IT STAYS CYRILLIC!. Of course there is an
unnecessary and involved workaound: Rename the file on disk, open (as
default will do now) and save AS the original name. But what the heck!?!

Can you please, please make this work as advertised?

Axel

#23451 From: Axel Berger <Axel-Berger@...>
Date: Wed Nov 28, 2012 10:26 pm
Subject: StrReplace
absalom_nemini
Send Email Send Email
 
There used to be the problem that ^!Replace could not use functions and
^$StrReplace()$ could not use Regex. The latter seems to be fixed,
except for one thing:

How do I use the found string? $1 does not seem to work. The following
should convert Russian characters from cp-1251 to Unicode-entities (one
line):

^!InsertText
^$StrReplace("[\xC0-\xF0]";"&#^$Calc(848+^$CharToDec($1)$;0)$;";"^$GetSelection$\
";RA)$

It doesn't, everything is 848.

How can I do it?

Danke
	 Axel

--
             Dipl.-Ing. F. Axel Berger      Tel: +49/ 2174/ 7439 07
             Johann-Häck-Str. 14            Fax: +49/ 2174/ 7439 68
             D-51519 Odenthal-Heide       eMail: Axel-Berger@...
             Deutschland (Germany)         http://berger-odenthal.de

#23452 From: hsavage <hsavage@...>
Date: Thu Nov 29, 2012 6:29 am
Subject: Re: [Clip] StrReplace
hrs62930
Send Email Send Email
 
On 11/28/2012 4:26 PM, Axel Berger wrote:
> There used to be the problem that ^!Replace could not use functions and
> ^$StrReplace()$ could not use Regex. The latter seems to be fixed,
> except for one thing:
>
> How do I use the found string? $1 does not seem to work. The following
> should convert Russian characters from cp-1251 to Unicode-entities (one
> line):
>
> ^!InsertText
>
^$StrReplace("[\xC0-\xF0]";"&#^$Calc(848+^$CharToDec($1)$;0)$;";"^$GetSelection$\
";RA)$
>
> It doesn't, everything is 848.
>
> How can I do it?
>
> Danke
>  Axel

Axel,

I'm way behind with regex but in your case you may need to try the
NoteTab fixed variable ^%Dollar%.

^$CharToDec(^%Dollar%1)$;0)$


--
···············································
¤. JD#...333 - ¤. SL...1054 - 12.11.28~12.28.03

. On A Fence: Salesmen Welcome. Dog Food Is Expensive.

EUR hrs EUR  hsavage EUR pobox EUR com



[Non-text portions of this message have been removed]

#23453 From: Axel Berger <Axel-Berger@...>
Date: Thu Nov 29, 2012 8:22 am
Subject: Re: [Clip] StrReplace
absalom_nemini
Send Email Send Email
 
hsavage wrote:
> fixed variable ^%Dollar%.
> ^$CharToDec(^%Dollar%1)$;0)$

Doesn't help. In my UTF converter, where I expected only few such
characters loosely scattered through the text I looped through
individual chars. Here, where it is a compact block of all Russian, I
hoped to avoid a second inner loop.

Axel

#23454 From: Axel Berger <Axel-Berger@...>
Date: Thu Nov 29, 2012 8:32 am
Subject: Re: [Clip] StrReplace
absalom_nemini
Send Email Send Email
 
Axel Berger wrote:
> I hoped to avoid a second inner loop.

Addendum: I can't use an inner loop.

^!Find "something" H

selects the found item and destroys the outer selection.

^!Replace "old" >> "new" H

doesn't allow a function in "new".

I might go to the length of doing

^!Replace "old" >> "#markrussian#old#endmark#" H

and run a second loop over the whole text without changing non-russian
upper characters. This is becoming a lot of hassle for a simple task.

Axel

#23455 From: "flo.gehrke" <flo.gehrke@...>
Date: Thu Nov 29, 2012 11:41 am
Subject: Re: StrReplace
flo.gehrke
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> How do I use the found string? $1 does not seem to work.

'^$CharToDec()$ is a conventional string function that can't deal with a RegEx
metacharacter. So '$1' isn't interpreted as a back reference here but as a
literal:

^!Info ^$CharToDec($1)$ --> 36. i.e. the decimal value of '$' (1 is ignored)

Maybe you could resolve it with something like...

^!Find "[\xC0-\xF0]" RS
^!Set %Char%="&#^$Calc(848+^$CharToDec(^$GetSelection$)$)$;"
^!InsertText ^$StrReplace("^$GetSelection$";"^%Char%";"^$GetSelection$";RA)$

Also note: '[\xC0-\xF0]' wouldn't work as a substring unless it written in
parentheses. Example:

^!Info ^$StrReplace("(apple)\x20tree";"$1\x20pie";"apple tree";R)$ --> apple pie

Regards,
Flo

#23456 From: "flo.gehrke" <flo.gehrke@...>
Date: Thu Nov 29, 2012 12:10 pm
Subject: Re: StrReplace
flo.gehrke
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
>
> Maybe you could resolve it with something like (corrected)...
>
> ^!Find "[\xC0-\xF0]" RS
> ^!Set %Char%="&#^$Calc(848+^$CharToDec(^$GetSelection$)$)$;"
> ^!InsertText ^$StrReplace("^$GetSelection$";"^%Char%";"^$GetSelection$";R)$

Or just...

^!Find "[\xC0-\xF0]" R
^!Set %Char%="&#^$Calc(848+^$CharToDec(^$GetSelection$)$)$;"
^!Replace "^$GetSelection$" >> "^%Char%" ST

Regards,
Flo

#23457 From: Axel Berger <Axel-Berger@...>
Date: Thu Nov 29, 2012 4:16 pm
Subject: Re: [Clip] Re: StrReplace
absalom_nemini
Send Email Send Email
 
"flo.gehrke" wrote:
> > ^!Find "[\xC0-\xF0]" RS

Yes, but it needs to be a Find H inside a selection and the first hit
destroys it. I'll now use a regex ^!Replace to mark the russian letters
and a second ^!Find loop to work them one by one.

And thanks for the other hints - I had spotted the missing parentheses
myself, but it did take some time.

Axel

#23458 From: "John Shotsky" <jshotsky@...>
Date: Thu Nov 29, 2012 4:38 pm
Subject: RE: [Clip] Re: StrReplace
shotsky1
Send Email Send Email
 
I often do things like this, and find it easiest to do the initial find, then
use replaces within that find, then loop
back to do another find. You can use IfError Next within a selection without
breaking the selection. I also use \K and
(?=…) to limit the find to only the exact character strings that I want to
operate on. Sometimes (?s) is also needed if
line breaks are involved in the find.

So, overall structure is this:
Jump 1
:Start
Find [whatever]
IfError End
Replace [whatever] >> [whatever] AHIRS0
IfError Next Else Skip_-1
[any other Replaces that are needed]
^!Jump Select_End
GoTo Start
:End

The result is a loop within a loop without breaking the selection.

Regards,
John
RecipeTools Web Site:  <http://recipetools.gotdns.com/>
http://recipetools.gotdns.com/

From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of
Axel Berger
Sent: Thursday, November 29, 2012 08:17
To: ntb-clips@yahoogroups.com
Subject: Re: [Clip] Re: StrReplace


"flo.gehrke" wrote:
> > ^!Find "[\xC0-\xF0]" RS

Yes, but it needs to be a Find H inside a selection and the first hit
destroys it. I'll now use a regex ^!Replace to mark the russian letters
and a second ^!Find loop to work them one by one.

And thanks for the other hints - I had spotted the missing parentheses
myself, but it did take some time.

Axel



[Non-text portions of this message have been removed]

#23459 From: Axel Berger <Axel-Berger@...>
Date: Thu Nov 29, 2012 5:58 pm
Subject: Re: [Clip] Re: StrReplace
absalom_nemini
Send Email Send Email
 
John Shotsky wrote:
> Replace [whatever] >> [whatever] AHIRS0
> IfError Next Else Skip_-1

That If ought to be superfluous - the A already does the same.

And yes, thats exactly what I'm going to do, except that with Replace I
can only set a marker, not the final thing which requires using a
function.
As ^$Function($1)$ can't be used I'll have to loop them one by one and
use ^$Function(^$GetSelection$)$.

Never mind. In most cases there won't be any Russian and then it all
boils down to two failed Finds, that take up no time whatever. Still,
Regex and functions would be very nice to have in the same Replace
command or function.

Axel

#23460 From: Axel Berger <Axel-Berger@...>
Date: Fri Nov 30, 2012 3:21 pm
Subject: Re: [Clip] Re: StrReplace
absalom_nemini
Send Email Send Email
 
Axel Berger wrote:
> And yes, that's exactly what I'm going to do,

To finalize the thread, this is what I've come up with and what seems to
work fine:

:russian
^!Jump TEXT_START
:russloop
;long line start
^!Find "(?s)^\\inputencoding\{x-cp1251(.*?)^\\inputencoding\{x-atarist"
HRS1
;long line end
;^!Continue
^!IfError unicode
^!Replace "([\xC0-\xFF])" >> "&#R$1;" HRAST
^!Goto russloop
:unicode
^!Jump TEXT_START
:uniloop
^!Find "&#(R.);" RS1
;^!Continue
^!IfError atari
;long line start
^!InsertText
^$Calc(848+^$CharToDec(^$StrCopyRight("^$GetSelection$";1)$)$;0)$
;long line end
^!Goto uniloop
:atari

Axel

#23461 From: "joy8388608" <mycroftj@...>
Date: Fri Nov 30, 2012 3:34 pm
Subject: [Clip] Re: StrReplace
joy8388608
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> "flo.gehrke" wrote:
> > > ^!Find "[\xC0-\xF0]" RS
>
> Yes, but it needs to be a Find H inside a selection and the first hit
> destroys it. I'll now use a regex ^!Replace to mark the russian letters and a
second ^!Find loop to work them one by one.
>
> Axel
>

How about a set of farclip subroutines that remember the current selection and
reselect the remembered selection? That would be a nice enhancement!

Joy

#23462 From: Axel Berger <Axel-Berger@...>
Date: Fri Nov 30, 2012 3:43 pm
Subject: Opening files
absalom_nemini
Send Email Send Email
 
In View-->Options-->Files I've set "Match Directories". It seems that
when no file is open NoteTab remebers the last "Save As" directory. I
would find it much more helpful and much more intuitive, if the last
"Open" directory was rembered.

Danke
	 Axel

--
             Dipl.-Ing. F. Axel Berger      Tel: +49/ 2174/ 7439 07
             Johann-Häck-Str. 14            Fax: +49/ 2174/ 7439 68
             D-51519 Odenthal-Heide       eMail: Axel-Berger@...
             Deutschland (Germany)         http://berger-odenthal.de

#23463 From: "flo.gehrke" <flo.gehrke@...>
Date: Sat Dec 1, 2012 4:25 pm
Subject: [Clip] Re: StrReplace
flo.gehrke
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> To finalize the thread, this is what I've come up with and what
; seems to work fine:
>
> :russian
> ^!Jump TEXT_START
> :russloop
> ;long line start
> ^!Find "(?s)^\\inputencoding\{x-cp1251(.*?)^\\inputencoding\{x-atarist"
> HRS1
> ;long line end
> ;^!Continue
> ^!IfError unicode
> ^!Replace "([\xC0-\xFF])" >> "&#R$1;" HRAST
> ^!Goto russloop
> :unicode
> ^!Jump TEXT_START
> :uniloop
> ^!Find "&#(R.);" RS1
> ;^!Continue
> ^!IfError atari
> ;long line start
> ^!InsertText
> ^$Calc(848+^$CharToDec(^$StrCopyRight("^$GetSelection$";1)$)$;0)$
> ;long line end
> ^!Goto uniloop
> :atari


Interesting solution!

Maybe you could even omit marking those characters with 'R'. Search those
characters inside the selection, assign them to an array, and edit them one
after another in the same order.

I don't have your data and couldn't test it. But possibly it could work as
follows:


^!Find "(?s)^\\inputencoding\{x-cp1251.*?^\\inputencoding\{x-atarist" WRS
^!SetListDelimiter "|"
^!SetArray %Char%=^$GetDocListAll("[\xC0-\xFF]";"&#$0;|")$
^!Set %i%=1

:Loop
^!Find "[\xC0-\xFF]" RS
;  Long line start
^!InsertText
^$StrReplace(^$GetSelection$;^$Calc(848+^$CharToDec(^$GetSelection$)$)$;"^%Char^\
%i%%";R)$
;  Long line end
^!Inc %i%
^!If ^%i% < ^%Char0 Loop


Regards,
Flo

#23464 From: Axel Berger <Axel-Berger@...>
Date: Sat Dec 1, 2012 4:38 pm
Subject: Re: [Clip] Re: StrReplace
absalom_nemini
Send Email Send Email
 
"flo.gehrke" wrote:
> Maybe you could even omit marking those characters with 'R'. Search
> those characters inside the selection, assign them to an array, and
> edit them one after another in the same order.

There may be more than one such foreign block and there may be more than
one lnguage, Greek and Hebrew are other possibilities. That's why I
needed the R to specify Russian.

Axel

#23465 From: Axel Berger <Axel-Berger@...>
Date: Sat Dec 1, 2012 4:46 pm
Subject: Finding matching parentheses
absalom_nemini
Send Email Send Email
 
In my documents I have this string:

\foreignlanguage{greek}{Qr'onos}

To convert that from TeX to HTML I need to find the greek word "Qr'onos"
Easy:

^!Find "\\foreignlanguage\{greek\}\{([^\}]+)\}" RS1

But what if the word or phrase contains an inner {} pair? How to I find
and select from the starting outer { up to its matching closing } ?

Danke
	 Axel

#23466 From: "Eb" <ebbtidalflats@...>
Date: Sat Dec 1, 2012 5:05 pm
Subject: Re: Finding matching parentheses
ebbtidalflats
Send Email Send Email
 
When matching tag paris in html, I use a loop and a stack to match up pairs. For
nested brackets a simlar technique might work. Except there is no need to use a
stack, since the target is always the same. Just use a counter.


Start with the 1st opening bracket,
    set the counter to 1
    save your cursor position GetRowStart:GetColStart.
Search for the next bracket (\{)|(\}) (open or close).
    If it is another opening brace, increment a counter
    If a closing brace, decrement the counter.
When the counter is back to zero, you're done
    Save the END cursor position, and select between
    Start and end.

You can track the depth of the nesting with a second counter, that you set to
max(counte1,counter2). After counter1 returns to zero, counter2 reteins the
depth of the deepest nesting.

This technique also finds the closing brace, if there are parallel nested
braces:  {...{...}...{...}...}

You'll need help from a regexpert for doing this without a loop. I suspect it's
possible, but haven't a clue how.



Cheers


Eb




--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> In my documents I have this string:
>
> \foreignlanguage{greek}{Qr'onos}
>
> To convert that from TeX to HTML I need to find the greek word "Qr'onos"
> Easy:
>
> ^!Find "\\foreignlanguage\{greek\}\{([^\}]+)\}" RS1
>
> But what if the word or phrase contains an inner {} pair? How to I find
> and select from the starting outer { up to its matching closing } ?
>
> Danke
>  Axel
>

#23467 From: Axel Berger <Axel-Berger@...>
Date: Sat Dec 1, 2012 5:59 pm
Subject: Re: [Clip] Re: Finding matching parentheses
absalom_nemini
Send Email Send Email
 
Eb wrote:
> When the counter is back to zero, you're done
>    Save the END cursor position, and select between
>    Start and end.

Yes, I was afraid I might have to resort to somthing like that. The
shame is, NT already has everything needed in Search-->Match Brackets,
but no Clips function for it.

Still this works:

^!Find "\\foreignlanguage\{greek\}(\{)" RS1
^!Menu Search/"Match Brackets"
^!Set %var%=^$GetSelection$
^!Info ^%var%

on this minimal file:

Dummes Gelaber \foreignlanguage{greek}{Qr'onos} mehr Gelaber

Axel

#23468 From: "twinlor" <tmp5@...>
Date: Sat Dec 1, 2012 11:56 pm
Subject: Leading zero's removed using ^!Inc
twinlor
Send Email Send Email
 
Hi All,

I am building a library to hold file renaming clips.  Thanks to our good friend
Jody I've got a starting point.. his clip 'Rename FileNames/Increment...' from
his DirStuff library.

I want to allow user to designate the number of characters for the incrementing
variable AND use leading zero's.

examples of final results:
newname_001.txt thru newname_087.txt
or
newname_024.png thru newname_547.png

I cannot see how to set the number of characters for the counting variable and
the ^!Inc command trims leading zero's.

Any help or directions?

Thanks,

David

#23469 From: Axel Berger <Axel-Berger@...>
Date: Sun Dec 2, 2012 12:08 am
Subject: Re: [Clip] Leading zero's removed using ^!Inc
absalom_nemini
Send Email Send Email
 
twinlor wrote:
> Any help or directions?

Yes, that's an oldie. If %var% is your number, then what you use in the
filename is:

^$StrCopyRight("000^%var%";3)$

Axel

#23470 From: "twinlor" <tmp5@...>
Date: Sun Dec 2, 2012 12:59 am
Subject: Re: [Clip] Leading zero's removed using ^!Inc
twinlor
Send Email Send Email
 
Thanks, Axel.

I will implement tomorrow.  I don't see exactly how but I'll be back if
necessary.  PLEASE DON'T TELL ME YET.  I need to learn.

- David



> > Any help or directions?
>
> Yes, that's an oldie. If %var% is your number, then what you use in the
> filename is:
>
> ^$StrCopyRight("000^%var%";3)$
>
> Axel
>

#23471 From: "m.feichtinger" <mafei@...>
Date: Sun Dec 2, 2012 9:37 pm
Subject: Re: Finding matching parentheses
m.feichtinger
Send Email Send Email
 
From the help file of NTP62 "Regular Expressions, Recursive Pattern":
 	 \( ( [^()]++ | (?R) )* \)
Or in a lager pattern:
 	 ( \( ( [^()]++ | (?1) )* \) )

In your case:
^!Find "\\foreignlanguage\{greek\}(\{([^{}]++|(?1))*\})" rs1

The same as named recursion (long line):
^!Find "(?x)\\foreignlanguage\{greek\} (?<braces>(?#named) \{ ( [^{}]++ |
(?&braces)(?#recursion; reference by name) )* \} )" rs1

Finds the outer braces and all nested braces between from:
   Dummes Gelaber \foreignlanguage{greek}{Qr'onos} mehr Gelaber
or (long line):
   Dummes Gelaber \foreignlanguage{greek}{Qr'o {some nested {and some more}
braces} nos} mehr Gelaber

You can then skip the enclosing braces, i.e.
^!Set
%var%=^$StrCopy("^$GetSelection$";2;^$Calc(^$StrSize("^$GetSelection$")$-2)$)$

HTH

--- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
>
> In my documents I have this string:
>
> \foreignlanguage{greek}{Qr'onos}
>
> To convert that from TeX to HTML I need to find the greek word "Qr'onos"
> Easy:
>
> ^!Find "\\foreignlanguage\{greek\}\{([^\}]+)\}" RS1
>
> But what if the word or phrase contains an inner {} pair? How to I find
> and select from the starting outer { up to its matching closing } ?
>
> Danke
>  Axel
>

#23472 From: "flo.gehrke" <flo.gehrke@...>
Date: Mon Dec 3, 2012 1:36 pm
Subject: Re: Finding matching parentheses
flo.gehrke
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "m.feichtinger" <mafei@...> wrote:
>
> In your case:
> ^!Find "\\foreignlanguage\{greek\}(\{([^{}]++|(?1))*\})" rs1
>
> Finds the outer braces and all nested braces between from:
>   Dummes Gelaber \foreignlanguage{greek}{Qr'onos} mehr Gelaber
> (...)
> You can then skip the enclosing braces, i.e.
> ^!Set
%var%=^$StrCopy("^$GetSelection$";2;^$Calc(^$StrSize("^$GetSelection$")$-2)$)$

You will achieve the same result without ^$StrCopy$ when writing...

^!Find "(?x)\\foreignlanguage\{greek\} (\{ ( ([^{}]++|(?1) )* )\} )" RS2

So far, however, we didn't see any "inner {} pair" in the sample strings. Also
in...

Dummes Gelaber \foreignlanguage{greek}{Qr'onos} mehr Gelaber

there is no sequence of outer and inner brackets but a sequence of two
parenthesized strings. So I suppose it's about something like...

\foreignlanguage{greek}{Axel{Berger}Odenthal}

Since there isn't much recursion needed here I think a simple pattern like...

^!Find "\\foreignlanguage\{greek}\{(.+)}" RS1

will suffice here.

If the outer braces should be enclosed in the match (as with Axel's latest clip)
try...

^!Find "\\foreignlanguage\{greek}(\{.+})" RS1

Regards,
Flo

#23473 From: Axel Berger <Axel-Berger@...>
Date: Mon Dec 3, 2012 4:32 pm
Subject: Re: [Clip] Re: Finding matching parentheses
absalom_nemini
Send Email Send Email
 
"flo.gehrke" wrote:
> If the outer braces should be enclosed in the match
> (as with Axel's latest clip)

I'd rather not include them, that's just what Match Brackets does. I'd
have had to eliminate them later.

> So I suppose it's about something like...
> \foreignlanguage{greek}{Axel{Berger}Odenthal}

Yes. Or rather some LaTeX construct like \v{s} for an accented s.

> I think a simple pattern like...
> ^!Find "\\foreignlanguage\{greek}\{(.+)}" RS1
> will suffice here.

No, that'll find "Axel{Berger" in the example above, not
"Axel{Berger}Odenthal"

Danke
	 Axel

#23474 From: "joy8388608" <mycroftj@...>
Date: Mon Dec 3, 2012 11:52 pm
Subject: Would like better way to increment filename by one
joy8388608
Send Email Send Email
 
I thought this would be easier than it was and can't shake the feeling that
there is a better way than what I can come up with so I ask for creative ideas
here.

I wanted a subroutine to increment trailing digits of filename. This is useful
for creating backups and sequential files.

Parsing the filename itself is no problem (i.e., picking off the folder, drive,
etc. to isolate the actual file name).  What I want is to increment the trailing
digits while leaving AT LEAST the same number of digits as examples below.

bkup3->bkup4  bkup01->bkup02  bkup99->bkup100  bkup0098->bkup0099->bkup0100

If no numeric trailing digits, append 01.     bkup->bkup01

This is all relatively simple except for the keeping (at least) the same number
of digits since ^!Inc strips leading zeros and adding one to 0098 would give 99.

I created the routine by isolating the trailing digits, adding one and padding
the result to the proper length.

Can anyone come up with an elegant way to convert bkup009 to bkup010 and bkup999
to bkup1000?

(This would be a nice built-in function, eh?)

Thanks,
Joy

#23475 From: Don <don@...>
Date: Tue Dec 4, 2012 12:01 am
Subject: Re: [Clip] Would like better way to increment filename by one
dpasseng
Send Email Send Email
 
This was answered just yesterday Joy.  Search the messages from yesterday.

Messages 23446 - 23475 of 23883   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help