Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

variables & grep - becoming too complicated

Community Beginner ,
Oct 09, 2014 Oct 09, 2014

hi!

may someone can help me?

i'm working daily with a grep expression witch becomes longer and longer and so the risk of errors becomes bigger.

what i need to do:

search for:

\<([\d]+([\.,][\d]+)*)([Different types of spaces]?)([Word1|Word2|…Word20)\>

replace with:

$1~S~<$3

Problem:

The list of words should be edited by other users and can contain caracters like € or ² – because of this i was thinking of something like a file with tab separated words.

In the replace with expression are to different spaces underlined – before doing the search and replace i always need to decide what to use and modify the search accordingly.

I would love to do this choice by a radiobutten.


Any ideas how i can realize this?

I just started to learn javascript so using external txt files for defining a variable is not really within my skills now.



TOPICS
Scripting
736
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 09, 2014 Oct 09, 2014

FindChangeByList

Have you looked at this script? May not be exactly what you like with an actual user interface...

Regards

Romano


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 09, 2014 Oct 09, 2014

hi romano!

thanks for your reply.

yes i have had a look on FindChangebyList but the mentioned text file with the search words needs to be edited by different people without of any grep-knowledge.

thomas

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 09, 2014 Oct 09, 2014

Hi Thomas

I have spent the last week or so to rewrite the Find Change script into a CEP plugin.

I did this to find out how the new CEP platform works. I would not claim I mastered it yet. But I learned a lot about how not to do it.

I would imagine that the interface for the script could take the kind of features (radio buttons etc) you want.

Do you have a budget for this? Let me know and maybe we can spec this so it does some simple things for starter and then build on it.

Regards

Romano

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 09, 2014 Oct 09, 2014

whats a CEP plugin?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 09, 2014 Oct 09, 2014

Hello,

Here is a grep / find replace with a UI.

http://www.indigrep.com/index.php?post/2013/08/05/XStrings-%3A-nouveau-venu-parmi-les-scripts-Recher...

Also a very nice write up.

P.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 09, 2014 Oct 09, 2014

thanks, but thats not what i need.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 16, 2014 Oct 16, 2014

Thomas, a picture says more than 1000 words …

First of all ([\d]+([\.,][\d]+)*) could a bit simplified: (\d+([.,]\d+)*) or maybe this work too: (\d[^\s]+)

Then you should provide some real examples. ([Different types of spaces]?)([Word1|Word2|…Word20) isn’t really helpful.

So built a idml-example and a example with your textfile and provide those files for download to all scripters here.

From where should the script collect your textfile (same folder as the .indd?)

What is the name of this file?

Do you want to search the whole document or a selection?

– Kai

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 16, 2014 Oct 16, 2014
LATEST

Hi Kai!

Thanks for your response.

In two days i will be back home - then i can provide some real world examples.

As for now here is, more exact, what i want to do:

I like to search for a (random) number with a unit.

I don’t now the number and the unit, for example „km²“ is defined in the text file.

Sometimes there is a space between the number and the unit – but this space can’t be search by \s because tabs should be ignored.

The script should provide the possibility to insert a nonbreaking space or a thin space.

The text file can have a name like units1.txt and should be inside of a separate folder within the script folder.

I like to search in the whole document.

Thomas

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines