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

Forgive my ignorance in Grep but...

Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

how do you search and remove numbers like dd.dd where the second digit string can be one or two in size? For example 

18.55

or 

18.5

TOPICS
Scripting

Views

169

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Oct 19, 2022 Oct 19, 2022

Grep:

 

(\b\d{2})\.\d{1,2}\b

 

Change to:

$1

- Mark

 

Edit: didn't read the question right at first!

Votes

Translate

Translate
Community Expert ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

Grep:

 

(\b\d{2})\.\d{1,2}\b

 

Change to:

$1

- Mark

 

Edit: didn't read the question right at first!

Votes

Translate

Translate

Report

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 Expert ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

You want to go from 18.55

or 18.5

to 18

???

 

\d+\K\.\d{1,2}

 

Votes

Translate

Translate

Report

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 Expert ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

@Eugene Tyson, that will also match part of longer digit strings, eg. in "1234.1234" it will match ".12". ( I did the same as you at first and at least you read the question correctly!) - Mark

Votes

Translate

Translate

Report

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 Expert ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

Oh silly me I didn't try with longer string. Only with sample provided and it worked for me. 

But perhaps it was too open ended. 

 

Nice work on the GREP - I would have gotten there. 

I don't use much but know a little to help out from time to time - usually there is a much neater way to do things than the way I approach them.

 

Thanks

 

Votes

Translate

Translate

Report

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 Expert ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

Yeah Eugene, I'm the same. I give it a go, and then wait for the big kids to show me a *waaay* smarter approach. It's fun. 🙂

Votes

Translate

Translate

Report

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 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

No. I got your first response and it is exacty what I needed, THANKS!

Votes

Translate

Translate

Report

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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

LATEST

Don't apologize, GREP is all but an easy subject (it actually becomes easier with a lot of practice). What matters is to keep learning 😉

Also don't hesitate in taking advantage of the GREP F/C dialog within InDesign and the shortcuts the dialog offers (see @ button):

grep_formatted2

Then you can copy-paste supplied code as a starter.

FWIW

Loic

Votes

Translate

Translate

Report

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