Rank: Advanced Member Groups: Registered
Joined: 14/09/2013(UTC) Posts: 90 Was thanked: 24 time(s) in 16 post(s)
|
Hi, is anybody aware of a method to find every occurrence of a "variable name" in a document, and replace it with another "new variable name" in every formula/occurence? We have the built-in "find" (CTRL+F), but as far as I know it cannot replace also.
Does any plugin offer this feature?
Thanks Bye
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: fedeghi Hi, is anybody aware of a method to find every occurrence of a "variable name" in a document, and replace it with another "new variable name" in every formula/occurence? No, not as per you demand. Utilities Matrix Find_Replace.sm (24kb) downloaded 16 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,128 Was thanked: 509 time(s) in 339 post(s)
|
There is F8 key for replacing variable when you are inside of a function, line, etc. But there is not a global search and replace as far as I know.
Regards
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/12/2011(UTC) Posts: 319 Location: italy Was thanked: 109 time(s) in 93 post(s)
|
As a "sm" file is essentially an XML file, you can open it with an intelligent text editor (notepad ++) and do all the replacements with a special command
sergio
|
1 user thanked PompelmoTell for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/09/2013(UTC) Posts: 90 Was thanked: 24 time(s) in 16 post(s)
|
Originally Posted by: overlord There is F8 key for replacing variable when you are inside of a function, line, etc. But there is not a global search and replace as far as I know.
Thanks Overlord, I forgot to mention that I was referring to global "environment" instead of local variables inside a function Originally Posted by: PompelmoTell As a "sm" file is essentially an XML file, you can open it with an intelligent text editor (notepad ++) and do all the replacements with a special command
Thanks Sergio, I will give it a try, didn't think at this method
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,648 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Text Region Utilities? |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
1 user thanked Davide Carpi for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/09/2013(UTC) Posts: 90 Was thanked: 24 time(s) in 16 post(s)
|
Originally Posted by: Davide Carpi Text Region Utilities?
Super! As usual...
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,128 Was thanked: 509 time(s) in 339 post(s)
|
Originally Posted by: Davide Carpi Text Region Utilities?
I wasn't using this on linux so totally forgot it. While I was not using Search and Replace has been added. It must be very long time since I had used it. When I tried search&replace on linux there is that bug again. Little blank squares are added front and end of variable. Same cosmetic bug of Numeric UpDown Region. But this time it effects variable names, not just cosmetic. Regards
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/09/2013(UTC) Posts: 90 Was thanked: 24 time(s) in 16 post(s)
|
Davide, is there a way / syntax that allows "Text Region Utilities" plugin to substitute some text with a new text containing greek letters? Example: Thanks, bye
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,648 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Originally Posted by: overlord When I tried search&replace on linux there is that bug again. Little blank squares are added front and end of variable. Same cosmetic bug of Numeric UpDown Region. But this time it effects variable names, not just cosmetic. That's odd, nothing more than what you set as replacements should be added; I'll investigate it. Originally Posted by: fedeghi Davide, is there a way / syntax that allows "Text Region Utilities" plugin to substitute some text with a new text containing greek letters? You can use regular expressions, like this: The syntax means: SEARCH anything that starts (^) with (S) and a subscript (\.) and capture anything after it ((.*)) [parethesis are the "capture" group, the period means "any character" and the asterisk "zero or more times"; BTW the subscript symbol is escaped with \ because otherwise it means "any character" ) REPLACE with sigma (σ) a subscript (.) and the first of the captured strings ($1) This might be simplified or much more complicated depending on the cases (what is available on the worksheet and the patterns) More on regular expressions: C# Regular ExpressionsA nice tool to test patterns, with live preview: regex101.comEdited by user 13 October 2021 14:16:35(UTC)
| Reason: Not specified |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/09/2013(UTC) Posts: 90 Was thanked: 24 time(s) in 16 post(s)
|
OK Davide, that's more or less the goal I had in mind, I'll need some more study about the proposed notation but you put me on the right path, thank you.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.