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

Help with easy GREP for find/change number ranges

Explorer ,
Jul 01, 2023 Jul 01, 2023

Copy link to clipboard

Copied

Looking for an easy way to change a hyphen between dates to a long dash. e.g. 1- to 1–, etc from 0-1.

But I don't want to change hyphens that appear between numbers in URLs, or between number and word (e.g. 21-year-old) Just dates, like 2001-2008 --> 2001–2008 and also between page ranges (

The Journal of Economic History, 43, no.1 (1983): 89-100. --> 

The Journal of Economic History, 43, no.1 (1983): 89–100.

TOPICS
How to , Print , Scripting , Type

Views

293

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

Guide , Jul 01, 2023 Jul 01, 2023

… Excluding first Urls,

 

Find: \d\K-(?=\d)

Replace by: 

 

(^/)  The Jedi

Votes

Translate

Translate
Community Expert ,
Jul 01, 2023 Jul 01, 2023

Copy link to clipboard

Copied

In the Find/Change Dialogs, Grep tab you can use the following

Find What :- (\d{4}) - (\d{4})

Change To :- $1 – $2

-Manan

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
Guide ,
Jul 01, 2023 Jul 01, 2023

Copy link to clipboard

Copied

… Excluding first Urls,

 

Find: \d\K-(?=\d)

Replace by: 

 

(^/)  The Jedi

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 ,
Jul 01, 2023 Jul 01, 2023

Copy link to clipboard

Copied

Thanks, that works great. I need to learn GREP. Can you recommend any good tutorials/websites?

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 ,
Jul 01, 2023 Jul 01, 2023

Copy link to clipboard

Copied

LATEST

@Peter Kahrel wrote a great book. I think that page has a link for purchasing.

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