Find and replace?

Find and replace? - Is this feature available in some plug-in? - Mensajes

#1 Publicado: 12/10/2021 9:56:42
fedeghi

fedeghi

25 me gusta en 112 mensajes.

Grupo: User

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
#2 Publicado: 12/10/2021 10:18:54
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

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 (23,75 KiB) descargado 1238 vez(es).
#3 Publicado: 12/10/2021 14:25:51
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

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
#4 Publicado: 12/10/2021 14:56:27
sergio

sergio

127 me gusta en 342 mensajes.

Grupo: User

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
A 1 usuarios les gustó este mensaje
fedeghi 12/10/2021 15:54:00
#5 Publicado: 12/10/2021 15:56:31
fedeghi

fedeghi

25 me gusta en 112 mensajes.

Grupo: User

Wrote

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

Wrote

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
#6 Publicado: 12/10/2021 16:11:30
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

F8.PNG
#7 Publicado: 12/10/2021 16:14:15
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

Text Region Utilities?

Archivo no encontrado. Archivo no encontrado.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
A 2 usuarios les gustó este mensaje
fedeghi 12/10/2021 16:45:00, francesco rapuano 12/1/2025 17:40:00
#8 Publicado: 12/10/2021 16:44:38
fedeghi

fedeghi

25 me gusta en 112 mensajes.

Grupo: User

Wrote

Text Region Utilities?


Super! As usual...
#9 Publicado: 12/10/2021 17:39:35
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

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
#10 Publicado: 13/10/2021 4:21:57
fedeghi

fedeghi

25 me gusta en 112 mensajes.

Grupo: User

Davide, is there a way / syntax that allows "Text Region Utilities" plugin to substitute some text with a new text containing greek letters?
Example:

Immagine 2021-10-13 092001.png

Thanks, bye
#11 Publicado: 13/10/2021 7:41:58
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

Wrote

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.

Wrote

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:

2021-10-13 12_35_21-.png

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 Expressions

A nice tool to test patterns, with live preview: regex101.com
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#12 Publicado: 13/10/2021 9:09:56
fedeghi

fedeghi

25 me gusta en 112 mensajes.

Grupo: User

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.
  • Nuevos mensajes
  • Sin mensajes nuevos